diff options
author | Alice Frosi <afrosi@redhat.com> | 2023-05-09 10:38:21 +0200 |
---|---|---|
committer | Alice Frosi <afrosi@redhat.com> | 2023-05-09 15:58:23 +0200 |
commit | 0977f0876af186975d3861c53b8431a80a27fa83 (patch) | |
tree | 9ace2c75d0389175591e8f3b9cf7e6589330514f /tests/unit/testutil.h | |
parent | 384d09cd3d2e62bae19b59b615bc57b7a23d0b0a (diff) | |
download | seitan-0977f0876af186975d3861c53b8431a80a27fa83.tar seitan-0977f0876af186975d3861c53b8431a80a27fa83.tar.gz seitan-0977f0876af186975d3861c53b8431a80a27fa83.tar.bz2 seitan-0977f0876af186975d3861c53b8431a80a27fa83.tar.lz seitan-0977f0876af186975d3861c53b8431a80a27fa83.tar.xz seitan-0977f0876af186975d3861c53b8431a80a27fa83.tar.zst seitan-0977f0876af186975d3861c53b8431a80a27fa83.zip |
gluten: check limits
Add bounds checking:
- if offset is larger then the maximum per offset type
- if memcpy is reading/writing inside gluten
Diffstat (limited to 'tests/unit/testutil.h')
-rw-r--r-- | tests/unit/testutil.h | 2 |
1 files changed, 2 insertions, 0 deletions
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; |