From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't read fields of a misaligned ExpandedObjectHeader or AnyArr
Date: Mon, 01 Jul 2019 00:36:19 +0000
Message-ID: <E1hhkIt-00049y-Bv@gemulon.postgresql.org> (raw)
Don't read fields of a misaligned ExpandedObjectHeader or AnyArrayType.
UBSan complains about this. Instead, cast to a suitable type requiring
only 4-byte alignment. DatumGetAnyArrayP() already assumes one can cast
between AnyArrayType and ArrayType, so this doesn't introduce a new
assumption. Back-patch to 9.5, where AnyArrayType was introduced.
Reviewed by Tom Lane.
Discussion: https://postgr.es/m/20190629210334.GA1244217@rfd.leadboat.com
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/4b85f20f948d885875a1e1b89979e627b86e6e64
Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c | 2 +-
src/include/utils/array.h | 19 +++++++++++++------
src/include/utils/arrayaccess.h | 4 ++--
src/include/utils/expandeddatum.h | 2 +-
4 files changed, 17 insertions(+), 10 deletions(-)
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: noah@leadboat.com
Subject: Re: pgsql: Don't read fields of a misaligned ExpandedObjectHeader or AnyArr
In-Reply-To: <E1hhkIt-00049y-Bv@gemulon.postgresql.org>
References: <E1hhkIt-00049y-Bv@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