From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid dereferencing an undefined pointer in DecodeInterval().
Date: Sun, 12 Feb 2023 17:51:02 +0000
Message-ID: <E1pRGVC-000mYO-61@gemulon.postgresql.org> (raw)
Avoid dereferencing an undefined pointer in DecodeInterval().
Commit e39f99046 moved some code up closer to the start of
DecodeInterval(), without noticing that it had been implicitly
relying on previous checks to reject the case of empty input.
Given empty input, we'd now dereference a pointer that hadn't been
set, possibly leading to a core dump. (But if we fail to provoke
a SIGSEGV, nothing bad happens, and the expected syntax error is
thrown a bit later.)
Per bug #17788 from Alexander Lakhin. Back-patch to v15 where
the fault was introduced.
Discussion: https://postgr.es/m/17788-dabac9f98f7eafd5@postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5e80d3515488a12f776ba14a07fbb5aa6b3ef013
Modified Files
--------------
src/backend/utils/adt/datetime.c | 2 +-
src/test/regress/expected/interval.out | 5 +++++
src/test/regress/sql/interval.sql | 3 +++
3 files changed, 9 insertions(+), 1 deletion(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Avoid dereferencing an undefined pointer in DecodeInterval().
In-Reply-To: <E1pRGVC-000mYO-61@gemulon.postgresql.org>
References: <E1pRGVC-000mYO-61@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox