Skip to content

Commit 9a75c19

Browse files
author
Sofia Kopikova
committed
PGPRO-11098 add null-pointer check to ptrack_set_init_lsn() function
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
1 parent 08cf80d commit 9a75c19

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

engine.c

+4
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,10 @@ XLogRecPtr
659659
ptrack_set_init_lsn(void)
660660
{
661661
XLogRecPtr new_lsn;
662+
663+
if (ptrack_map_size == 0 || ptrack_map == NULL)
664+
return InvalidXLogRecPtr;
665+
662666
if (RecoveryInProgress())
663667
new_lsn = GetXLogReplayRecPtr(NULL);
664668
else

0 commit comments

Comments
 (0)