1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-08 13:44:32 +02:00

Fix bug with page compression

This commit is contained in:
Konstantin Knizhnik 2018-11-07 22:06:50 +03:00
parent 3769efdcb2
commit 62d0f5fc97

View File

@ -368,7 +368,7 @@ compress_and_backup_page(pgFile *file, BlockNumber blknum,
BackupPageHeader header;
size_t write_buffer_size = sizeof(header);
char write_buffer[BLCKSZ+sizeof(header)];
char compressed_page[BLCKSZ];
char compressed_page[BLCKSZ*2]; /* compressed page may require more space than uncompressed */
if(page_state == SkipCurrentPage)
return;
@ -395,7 +395,7 @@ compress_and_backup_page(pgFile *file, BlockNumber blknum,
Assert (header.compressed_size <= BLCKSZ);
/* The page was successfully compressed. */
if (header.compressed_size > 0)
if (header.compressed_size > 0 && header.compressed_size < BLCKSZ)
{
memcpy(write_buffer, &header, sizeof(header));
memcpy(write_buffer + sizeof(header),