> On 15 Oct 2025, at 11:12, Chao Li <[email protected]> wrote:
>> On Oct 15, 2025, at 16:54, Алена Васильева <[email protected]> wrote:

>> The function timestamptz_to_str() in src/bin/pg_waldump/compat.c does not
>> handle the case when localtime() returns NULL, which can happen for 
>> timestamps
>> that are out of the supported time_t range on some platforms.
>> 
>> This patch adds a simple check for a NULL return value and ensures that the
>> function returns a clear error string "(timestamp out of range)" instead of
>> causing undefined behavior or a crash.

Ah yes, thanks for the reminder, it's been on my todo from
[email protected] for some time.

> I think we can just return a static const string, without copying the string 
> into “buf" as the function returns a “const char *”.

The function is documented as returning a value pointing to a static buffer, so
it seems better to consistently use that buffer.

--
Daniel Gustafsson



Reply via email to