From a7932050f65844fb1f1145fee87c72aadaf4f995 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 11 May 2023 13:08:43 -0400 Subject: config: Saturate on overflow in flex_sizeof() --- tests/bfstd.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/bfstd.c b/tests/bfstd.c index c6a9e9f..1917a53 100644 --- a/tests/bfstd.c +++ b/tests/bfstd.c @@ -41,6 +41,7 @@ int main(void) { }; assert(flex_sizeof(struct flexible, bar, 0) >= sizeof(struct flexible)); assert(flex_sizeof(struct flexible, bar, 16) % alignof(struct flexible) == 0); + assert(flex_sizeof(struct flexible, bar, SIZE_MAX / sizeof(int) + 1) == SIZE_MAX); assert(flex_sizeof_impl(8, 16, 4, 4, 1) == 16); // From man 3p basename -- cgit v1.2.3