summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/arrayfuncs.c
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2019-06-30 17:34:17 -0700
committerNoah Misch <noah@leadboat.com>2019-06-30 17:34:20 -0700
commitcd9d48969d944c3558a77745db389e8b68b46c4b (patch)
tree0a318da442c5f763a0c55ad76cdca24b159b4168 /src/backend/utils/adt/arrayfuncs.c
parenta1637caee9c77e30aaf4afb5c51e15cb67c4f3e3 (diff)
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
Diffstat (limited to 'src/backend/utils/adt/arrayfuncs.c')
-rw-r--r--src/backend/utils/adt/arrayfuncs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index c3ccf327fd9..944a77ebbc2 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -4108,7 +4108,7 @@ array_contain_compare(AnyArrayType *array1, AnyArrayType *array2, Oid collation,
nelems2 = array2->xpn.nelems;
}
else
- deconstruct_array(&(array2->flt),
+ deconstruct_array((ArrayType *) array2,
element_type, typlen, typbyval, typalign,
&values2, &nulls2, &nelems2);