Hi Ian,

On Thu, Dec 12, 2024 at 12:23 PM Ilyasov Ian <ianilya...@outlook.com> wrote:
> SIGSEGV was caused by two places in pg_controldata.c where there
> is a work with localtime(&time_tmp));. So I added a check for not NULL.
>
> ....
>
> Where casting second operand in % (XLogSegmentsPerXLogId(wal_segsz_bytes)) to 
> unsigned seems enough. Would be glad to hear your thoughts.

Thank you for catching this.  I think catching invalid timestamps is
good except we could use already existing string indicating this and
don't bother translators.  Also, I don't think we should change
segment size to uint32 as it's already defined as int in awfully a lot
of places.  Additionally WalSegMaxSize is clearly within the 32-bit
integer max value.  So, I think we can just adjust the check before
XLByteToSeg().  What do you think?

------
Regards,
Alexander Korotkov
Supabase

Attachment: v2-0001-Fix-possible-pg_control_data-errors-on-corrupted-.patch
Description: Binary data

Reply via email to