From 9a2c6d257e19a2a3c1f484225d089c2689b13bf1 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sat, 18 Oct 2025 11:30:38 +1000 Subject: [PATCH] util: ctypes: fix vla negative lengths Fix handling of negative lengths of `counted_by` fields. Signed-off-by: Jordan Yates --- src/infuse_iot/util/ctypes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/infuse_iot/util/ctypes.py b/src/infuse_iot/util/ctypes.py index e77602c..489770c 100644 --- a/src/infuse_iot/util/ctypes.py +++ b/src/infuse_iot/util/ctypes.py @@ -65,6 +65,7 @@ class property is not `None`, it will consume the remainder of if sub_count < 0: # Assume that negative length is an error code and use 0 vla_val.append(sub_base) + sub_vla_size = 0 else: sub_vla_type = sub_count * sub_array_base # Don't use ctypes.sizeof on constructed type, it returns the wrong value