forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
py/objtype: Validate super() arguments.
Fixes issue micropython#12830 i.e. 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. Signed-off-by: stijn <[email protected]>
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |