Skip to content

Commit 0ae518f

Browse files
committed
mp_obj_print_exception(): Assert that traceback has sane number of entries.
1 parent 89f94b5 commit 0ae518f

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

py/obj.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void mp_obj_print_exception(mp_obj_t exc) {
5252
machine_uint_t n, *values;
5353
mp_obj_exception_get_traceback(exc, &n, &values);
5454
if (n > 0) {
55+
assert(n % 3 == 0);
5556
printf("Traceback (most recent call last):\n");
5657
for (int i = n - 3; i >= 0; i -= 3) {
5758
#if MICROPY_ENABLE_SOURCE_LINE

0 commit comments

Comments
 (0)