From abbc0d00006c3126b9d1cf8150c21f4a8c56089a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 2 Jun 2017 06:48:12 -0700 Subject: ffi: don't allow size calculation of bitfield type. * ffi.c (ffi_size): Check for a bitfield type and diagnose. --- ffi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ffi.c b/ffi.c index 42a16db0..255a318d 100644 --- a/ffi.c +++ b/ffi.c @@ -3029,7 +3029,11 @@ val ffi_typedef(val name, val type) val ffi_size(val type) { + val self = lit("ffi-size"); struct txr_ffi_type *tft = ffi_type_struct_checked(type); + if (tft->size == 0 && bitfield_syntax_p(tft->syntax)) + uw_throwf(error_s, lit("~a: bitfield type ~s has no size"), + self, type, nao); return num(tft->size); } -- cgit v1.2.3