Skip to content

Commit 8a56be6

Browse files
djlowtherdpgeorge
authored andcommitted
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 <Duncan.Lowther@glasgow.ac.uk>
1 parent 1f601e8 commit 8a56be6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

extmod/moductypes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static inline mp_uint_t uctypes_struct_scalar_size(int val_type) {
155155

156156
// Get size of aggregate type descriptor
157157
static mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_uint_t *max_field_size) {
158-
if (t->len == 0) {
158+
if (t->len < 2) {
159159
syntax_error();
160160
}
161161

0 commit comments

Comments
 (0)