[PATCH] Possible NULL deref in str_time

From: Bill Moyers <moyers(at)agora-net(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] Possible NULL deref in str_time
Date: 2017-12-13 01:45:44
Message-ID: 71cfc8d9-32d8-2052-8f80-3beeb3831071@agora-net.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I noticed that the output of pg_localtime() in str_time() is not checked
and can sometimes return NULL. It's pretty unlikely to occur, I guess if
the time() function was acting funny. For example if I define this:

time_t
fake_time(void *blah)
{
return 0x0110000000000000;
}

and then call fake_time() instead of time() everywhere, then str_time()
does the NULL dereference at startup.

* possible-null-deref-in-str_time.patch

Check the pg_localtime() output. This should not have a performance
impact because this function is not called often.

Attachment Content-Type Size
possible-null-deref-in-str_time.patch text/x-patch 639 bytes

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2017-12-13 01:47:00 Re: [HACKERS] Transactions involving multiple postgres foreign servers
Previous Message Amit Langote 2017-12-13 01:41:24 Re: [HACKERS] pg_upgrade failed with error - ERROR: column "a" in child table must be marked NOT NULL