From 0977f0876af186975d3861c53b8431a80a27fa83 Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Tue, 9 May 2023 10:38:21 +0200 Subject: gluten: check limits Add bounds checking: - if offset is larger then the maximum per offset type - if memcpy is reading/writing inside gluten --- tests/unit/testutil.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/unit/testutil.h') diff --git a/tests/unit/testutil.h b/tests/unit/testutil.h index 45fe08f..ec881c7 100644 --- a/tests/unit/testutil.h +++ b/tests/unit/testutil.h @@ -20,6 +20,8 @@ static inline void *test_gluten_write_ptr(struct gluten *g, const struct gluten_offset x) { + ck_assert_msg(is_offset_valid(x), "offset out of bounds"); + switch (x.type) { case OFFSET_DATA: return (char *)g->data + x.offset; -- cgit v1.2.3