mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 11:40:18 +01:00
py/objtype: Validate super() arguments.
This fixes various null dereferencing and out-of-bounds access because super_attr assumes the held obj is effectively an object of the held type, which is now verified. Fixes issue #12830. Signed-off-by: stijn <stijn@ignitron.net>
This commit is contained in:
15
tests/basics/builtin_super.py
Normal file
15
tests/basics/builtin_super.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# Check that super rejects invalid arguments.
|
||||
try:
|
||||
super(str, 0)
|
||||
except TypeError:
|
||||
print("TypeError")
|
||||
|
||||
try:
|
||||
super(str, int)
|
||||
except TypeError:
|
||||
print("TypeError")
|
||||
|
||||
try:
|
||||
super(0, int)
|
||||
except TypeError:
|
||||
print("TypeError")
|
||||
Reference in New Issue
Block a user