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

Commitd16e84b

Browse files
committed
Fix ptrack map array index overflow when doing ptrackCheckpoint().
1 parentf490518 commitd16e84b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

‎engine.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ ptrackCheckpoint(void)
337337
XLogRecPtrinit_lsn;
338338
pg_atomic_uint64buf[PTRACK_BUF_SIZE];
339339
structstatstat_buf;
340-
inti=0;
341-
intj=0;
340+
uint64i=0;
341+
uint64j=0;
342342

343343
elog(DEBUG1,"ptrack checkpoint");
344344

@@ -430,14 +430,16 @@ ptrackCheckpoint(void)
430430

431431
if (j==PTRACK_BUF_SIZE)
432432
{
433-
intwritesz=sizeof(buf);
433+
intwritesz=sizeof(buf);/* Up to ~2 GB for buffer size seems
434+
* to be more than enough, so never
435+
* going to overflow. */
434436

435437
/*
436438
* We should not have any allignment issues here, since sizeof()
437439
* takes into account all paddings for us.
438440
*/
439441
ptrack_write_chunk(ptrack_tmp_fd,&crc, (char*)buf,writesz);
440-
elog(DEBUG5,"ptrack checkpoint: i%d, j%d, writesz %d PtrackContentNblocks "UINT64_FORMAT,
442+
elog(DEBUG5,"ptrack checkpoint: i"UINT64_FORMAT", j"UINT64_FORMAT", writesz %d PtrackContentNblocks "UINT64_FORMAT,
441443
i,j,writesz, (uint64)PtrackContentNblocks);
442444

443445
j=0;
@@ -450,7 +452,7 @@ ptrackCheckpoint(void)
450452
intwritesz=sizeof(pg_atomic_uint64)*j;
451453

452454
ptrack_write_chunk(ptrack_tmp_fd,&crc, (char*)buf,writesz);
453-
elog(DEBUG5,"ptrack checkpoint: final i%d, j%d, writesz %d PtrackContentNblocks "UINT64_FORMAT,
455+
elog(DEBUG5,"ptrack checkpoint: final i"UINT64_FORMAT", j"UINT64_FORMAT", writesz %d PtrackContentNblocks "UINT64_FORMAT,
454456
i,j,writesz, (uint64)PtrackContentNblocks);
455457
}
456458

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp