Skip to content

Commit

Permalink
PGPRO-11098 add null-pointer check to ptrack_set_init_lsn() function
Browse files Browse the repository at this point in the history
When ptrack extension is added to shared_preload_libraries, but
ptrack.map size is 0, we may encounter segmantation fault when calling
ptrack_backup_checkpoint_request_hook() function. This commit adds
additional null-pointer checks to ptrack_set_init_lsn() function called
by ptrack_backup_checkpoint_request_hook() to avoid this segfault
  • Loading branch information
Sofia Kopikova committed Oct 4, 2024
1 parent 08cf80d commit 9a75c19
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,10 @@ XLogRecPtr
ptrack_set_init_lsn(void)
{
XLogRecPtr new_lsn;

if (ptrack_map_size == 0 || ptrack_map == NULL)
return InvalidXLogRecPtr;

if (RecoveryInProgress())
new_lsn = GetXLogReplayRecPtr(NULL);
else
Expand Down

0 comments on commit 9a75c19

Please sign in to comment.