mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
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
This commit is contained in:
@ -4159,7 +4159,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);
|
||||
|
||||
|
Reference in New Issue
Block a user