extmod/moductypes: Validate that uctypes.struct addr argument is an int.

Fixes issue #12660.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2023-10-12 15:45:40 +11:00
parent 5015779a6f
commit 05cb1406ad
3 changed files with 8 additions and 1 deletions

View File

@@ -8,6 +8,12 @@ except ImportError:
data = bytearray(b"01234567")
# first argument isn't an integer
try:
uctypes.struct(data, {})
except TypeError:
print("TypeError")
# del subscr not supported
S = uctypes.struct(uctypes.addressof(data), {})
try:

View File

@@ -3,3 +3,4 @@ TypeError
TypeError
TypeError
TypeError
TypeError