From 8a56be66601e5f21f15a76bfc932c9beb8f7cdee Mon Sep 17 00:00:00 2001 From: Duncan Lowther Date: Tue, 7 Apr 2026 16:41:40 +0100 Subject: [PATCH] extmod/moductypes: Be more defensive with uctypes_struct_agg_size args. Eliminates read-beyond-end when calling `uctypes_struct_agg_size()` on the length 1 tuple (uctypes.ARRAY ,). Signed-off-by: Duncan Lowther --- extmod/moductypes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/moductypes.c b/extmod/moductypes.c index ed865f4263..7cac41dbcf 100644 --- a/extmod/moductypes.c +++ b/extmod/moductypes.c @@ -155,7 +155,7 @@ static inline mp_uint_t uctypes_struct_scalar_size(int val_type) { // Get size of aggregate type descriptor static mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_uint_t *max_field_size) { - if (t->len == 0) { + if (t->len < 2) { syntax_error(); }