diff options
| author | Damien George <damien@micropython.org> | 2023-11-21 22:28:57 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-11-21 22:28:57 +1100 |
| commit | f397a3ec318f3ad05aa287764ae7cef32202380f (patch) | |
| tree | 97fad3f7e5d4d9e5b746f790fc5a42a9eafc9df8 /tests | |
| parent | fce8d9fd55409ab1027beee5671bc653fb5beb97 (diff) | |
py/objslice: Validate that the argument to indices() is an integer.
Otherwise passing in a non-integer can lead to an invalid memory access.
Thanks to Junwha Hong and Wonil Jang @S2Lab, UNIST for finding the issue.
Fixes issue #13007.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/basics/slice_indices.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/basics/slice_indices.py b/tests/basics/slice_indices.py index b7f439ccc..ccd7667e9 100644 --- a/tests/basics/slice_indices.py +++ b/tests/basics/slice_indices.py @@ -25,3 +25,8 @@ print(A()[2:7:2].indices(5)) print(A()[2:7:-2].indices(5)) print(A()[7:2:2].indices(5)) print(A()[7:2:-2].indices(5)) + +try: + print(A()[::].indices(None)) +except TypeError: + print("TypeError") |
