Skip to content

Commit 802ac49

Browse files
committed
util: ctypes: fix vla negative lengths
Fix handling of negative lengths of `counted_by` fields. Signed-off-by: Jordan Yates <jordan@embeint.com>
1 parent f1801d5 commit 802ac49

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/infuse_iot/util/ctypes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class property is not `None`, it will consume the remainder of
6565
if sub_count < 0:
6666
# Assume that negative length is an error code and use 0
6767
vla_val.append(sub_base)
68+
sub_vla_size = 0
6869
else:
6970
sub_vla_type = sub_count * sub_array_base
7071
# Don't use ctypes.sizeof on constructed type, it returns the wrong value

0 commit comments

Comments
 (0)