aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/arrayaccess.h
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:21 -0700
commitb664b187d7ea6546ef4e0f32167a93c6a74dca08 (patch)
tree676358160351aabbebaf9b2fe43a9d7ee4361d67 /src/include/utils/arrayaccess.h
parent4a36c77156f2ff6e07a349cddc65e5dd21abc1a8 (diff)
downloadpostgresql-b664b187d7ea6546ef4e0f32167a93c6a74dca08.tar.gz
postgresql-b664b187d7ea6546ef4e0f32167a93c6a74dca08.zip
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/include/utils/arrayaccess.h')
-rw-r--r--src/include/utils/arrayaccess.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/utils/arrayaccess.h b/src/include/utils/arrayaccess.h
index 72575d4a829..2b4a71836db 100644
--- a/src/include/utils/arrayaccess.h
+++ b/src/include/utils/arrayaccess.h
@@ -83,8 +83,8 @@ array_iter_setup(array_iter *it, AnyArrayType *a)
{
it->datumptr = NULL;
it->isnullptr = NULL;
- it->dataptr = ARR_DATA_PTR(&a->flt);
- it->bitmapptr = ARR_NULLBITMAP(&a->flt);
+ it->dataptr = ARR_DATA_PTR((ArrayType *) a);
+ it->bitmapptr = ARR_NULLBITMAP((ArrayType *) a);
}
it->bitmask = 1;
}