Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit15fe6af

Browse files
committed
fix len calculation in 2pc file header
1 parent567f98f commit15fe6af

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/backend/access/transam/twophase.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,6 @@ ReadTwoPhaseFile(TransactionId xid, bool give_warnings)
12181218
if (crc_offset!=MAXALIGN(crc_offset))
12191219
{
12201220
CloseTransientFile(fd);
1221-
fprintf(stderr,"wrong crc offset in two-phase file \"%s\"\n",path);
12221221
returnNULL;
12231222
}
12241223

@@ -1245,7 +1244,6 @@ ReadTwoPhaseFile(TransactionId xid, bool give_warnings)
12451244
if (hdr->magic!=TWOPHASE_MAGIC||hdr->total_len!=stat.st_size)
12461245
{
12471246
pfree(buf);
1248-
fprintf(stderr,"muggle two-phase file \"%s\": no magic\n",path);
12491247
returnNULL;
12501248
}
12511249

@@ -1622,6 +1620,10 @@ RecreateTwoPhaseFile(TransactionId xid, void *content, int len)
16221620
pg_crc32cstatefile_crc;
16231621
intfd;
16241622

1623+
/* Crutch to fix crc and len check on 2pc file reading */
1624+
Assert( ((TwoPhaseFileHeader*)content)->total_len-sizeof(pg_crc32c) <=len);
1625+
len= ((TwoPhaseFileHeader*)content)->total_len-sizeof(pg_crc32c);
1626+
16251627
/* Recompute CRC */
16261628
INIT_CRC32C(statefile_crc);
16271629
COMP_CRC32C(statefile_crc,content,len);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp