micropython/py
Damien George 28b18c43fe py/compile: Fix potential Py-stack overflow in try-finally with return.
If a return is executed within the try block of a try-finally then the
return value is stored on the top of the Python stack during the execution
of the finally block.  In this case the Python stack is one larger than it
normally would be in the finally block.

Prior to this commit, the compiler was not taking this case into account
and could have a Python stack overflow if the Python stack used by the
finally block was more than that used elsewhere in the function.  In such
a scenario the last argument of the function would be clobbered by the
top-most temporary value used in the deepest Python expression/statement.

This commit fixes that case by making sure enough Python stack is allocated
to the function.

Fixes issue #13562.

Signed-off-by: Damien George <damien@micropython.org>
2024-01-31 12:56:29 +11:00
..
argcheck.c py: Remove the word "yet" from exception messages. 2022-12-06 13:34:52 +11:00
asmarm.c
asmarm.h py/asm{arm,thumb,x64,x86,xtensa}: Remove unused macros. 2023-10-27 15:41:02 +11:00
asmbase.c all: Fix spelling mistakes based on codespell check. 2023-04-27 18:03:06 +10:00
asmbase.h
asmthumb.c all: Fix spelling mistakes based on codespell check. 2023-04-27 18:03:06 +10:00
asmthumb.h py/asm{arm,thumb,x64,x86,xtensa}: Remove unused macros. 2023-10-27 15:41:02 +11:00
asmx64.c
asmx64.h py/asm{arm,thumb,x64,x86,xtensa}: Remove unused macros. 2023-10-27 15:41:02 +11:00
asmx86.c
asmx86.h py/asm{arm,thumb,x64,x86,xtensa}: Remove unused macros. 2023-10-27 15:41:02 +11:00
asmxtensa.c
asmxtensa.h py/asm{arm,thumb,x64,x86,xtensa}: Remove unused macros. 2023-10-27 15:41:02 +11:00
bc.c py/bc: Fix checking for duplicate **kwargs. 2022-11-28 11:23:22 +11:00
bc.h py: Pass in address to compiled module instead of returning it. 2022-12-08 12:27:23 +11:00
bc0.h
binary.c
binary.h
builtin.h py/makemoduledefs.py: Automatically declare delegation attr functions. 2023-06-14 19:03:46 +10:00
builtinevex.c py/builtinevex: Handle invalid filenames for execfile. 2023-10-12 15:17:59 +11:00
builtinhelp.c py/objmodule: Add a table of built-in modules with delegation. 2023-06-08 17:54:24 +10:00
builtinimport.c py/builtinimport: Simplify calls to stat_path(). 2024-01-30 11:43:41 +11:00
compile.c py/compile: Fix potential Py-stack overflow in try-finally with return. 2024-01-31 12:56:29 +11:00
compile.h py: Pass in address to compiled module instead of returning it. 2022-12-08 12:27:23 +11:00
dynruntime.h py/dynruntime: Add mp_get_buffer. 2023-10-16 11:23:11 +11:00
dynruntime.mk
emit.h py/compile: Fix scope of assignment expression target in comprehensions. 2023-03-09 12:13:12 +11:00
emitbc.c all: Fix spelling mistakes based on codespell check. 2023-04-27 18:03:06 +10:00
emitcommon.c py/compile: Fix scope of assignment expression target in comprehensions. 2023-03-09 12:13:12 +11:00
emitglue.c py: Change ifdef DEBUG_PRINT to if DEBUG_PRINT. 2023-09-29 13:04:38 +10:00
emitglue.h
emitinlinethumb.c
emitinlinextensa.c
emitnarm.c
emitnative.c py: Change ifdef DEBUG_PRINT to if DEBUG_PRINT. 2023-09-29 13:04:38 +10:00
emitnthumb.c
emitnx64.c
emitnx86.c
emitnxtensa.c
emitnxtensawin.c
formatfloat.c all: Fix various spelling mistakes found by codespell 2.2.6. 2023-10-03 11:24:50 +11:00
formatfloat.h
frozenmod.c
frozenmod.h
gc.c py/gc: Improve calculation of new heap size in split-heap-auto mode. 2023-12-19 18:34:23 +11:00
gc.h py/gc: Add "max new split" value in result of gc.mem_free(). 2023-09-15 12:19:13 +10:00
grammar.h
lexer.c py/lexer: Change token position for new lines. 2023-11-03 15:56:10 +11:00
lexer.h py/builtinevex: Handle invalid filenames for execfile. 2023-10-12 15:17:59 +11:00
make_root_pointers.py
makecompresseddata.py all: Fix spelling mistakes based on codespell check. 2023-04-27 18:03:06 +10:00
makemoduledefs.py py/makemoduledefs.py: Automatically declare delegation attr functions. 2023-06-14 19:03:46 +10:00
makeqstrdata.py py/qstr: Add support for MICROPY_QSTR_BYTES_IN_HASH=0. 2024-01-25 16:38:17 +11:00
makeqstrdefs.py py/makeqstrdefs.py: Stop generating temporary intermediate file. 2023-12-14 22:55:08 -08:00
makeversionhdr.py all: Switch to new preview build versioning scheme. 2023-10-06 12:10:14 +11:00
malloc.c py/malloc: Fix DEBUG_print() args in m_realloc_maybe. 2023-09-04 10:26:09 +10:00
map.c py/map: Clear value when re-using slot with ordered dictionaries. 2023-01-13 14:21:32 +11:00
misc.h py/obj: Fix mp_obj_is_type compilation with C++. 2023-11-17 14:31:42 +11:00
mkenv.mk windows: Use the MicroPython logo as application icon. 2023-11-07 17:22:52 +11:00
mkrules.cmake py/mkrules.mk: List hash files as byproducts. 2023-12-15 15:48:07 +11:00
mkrules.mk ports: Fix handling of paths containing spaces in Makefiles. 2024-01-24 10:43:18 +11:00
modarray.c all: Use MP_REGISTER_EXTENSIBLE_MODULE for overrideable built-ins. 2023-06-08 17:54:21 +10:00
modbuiltins.c py/modbuiltins: Share vstr_add_char's implementation of utf8 encoding. 2023-11-28 23:34:56 +11:00
modcmath.c
modcollections.c all: Use MP_REGISTER_EXTENSIBLE_MODULE for overrideable built-ins. 2023-06-08 17:54:21 +10:00
moderrno.c all: Use MP_REGISTER_EXTENSIBLE_MODULE for overrideable built-ins. 2023-06-08 17:54:21 +10:00
modgc.c py/gc: Add "max new split" value in result of gc.mem_free(). 2023-09-15 12:19:13 +10:00
modio.c all: Use MP_REGISTER_EXTENSIBLE_MODULE for overrideable built-ins. 2023-06-08 17:54:21 +10:00
modmath.c py/modmath: Fix two-argument math function domain check. 2023-02-24 15:55:12 +11:00
modmicropython.c py/gc: Make gc_dump_info/gc_dump_alloc_table take a printer as argument. 2023-03-10 10:58:10 +11:00
modstruct.c py/modstruct: Support pad bytes in struct format. 2023-09-01 14:50:49 +10:00
modsys.c py/modsys: Implement optional sys.intern. 2023-12-15 11:43:39 +11:00
modthread.c py/misc: Change sizeof to offsetof for variable-length alloc. 2023-11-03 16:03:18 +11:00
mpconfig.h py/mpconfig: Disable qstr hashing at minimum feature level. 2024-01-25 16:38:17 +11:00
mperrno.h all: Rename UMODULE to MODULE in preprocessor/Makefile vars. 2023-06-08 17:54:11 +10:00
mphal.h ports: Fix sys.stdout.buffer.write() return value. 2023-12-22 10:32:46 +11:00
mpprint.c
mpprint.h
mpstate.c
mpstate.h py/modthread: Initialise nlr_jump_callback_top on threads. 2023-10-18 09:18:23 +11:00
mpthread.h py/modthread: Return thread id from start_new_thread(). 2023-09-03 18:49:18 +10:00
mpz.c
mpz.h
nativeglue.c py/dynruntime: Add mp_get_buffer. 2023-10-16 11:23:11 +11:00
nativeglue.h py/dynruntime: Add mp_get_buffer. 2023-10-16 11:23:11 +11:00
nlr.c py/nlr: Implement jump callbacks. 2023-06-02 21:50:57 +10:00
nlr.h py/nlr: Implement jump callbacks. 2023-06-02 21:50:57 +10:00
nlraarch64.c py/nlraarch64: Fix dangerous use of input register. 2023-06-14 17:43:44 +10:00
nlrmips.c py/nlrmips: Add native NLR support for MIPS architecture. 2022-11-15 17:09:49 +11:00
nlrpowerpc.c
nlrsetjmp.c py/nlrsetjmp: Use MP_NLR_JUMP_HEAD macro to simplify code. 2023-06-02 21:47:34 +10:00
nlrthumb.c
nlrx64.c py/nlrx64: Mark nlr_push() as naked function when possible. 2023-09-20 11:48:36 +10:00
nlrx86.c
nlrxtensa.c
obj.c py/obj: Generalise mp_get_buffer so it can raise if a flag is set. 2023-10-16 11:22:55 +11:00
obj.h py/obj: Fix mp_obj_is_type compilation with C++. 2023-11-17 14:31:42 +11:00
objarray.c py/objarray: Disallow memoryview addition. 2023-05-19 13:33:54 +10:00
objarray.h py/objarray: Raise error on out-of-bound memoryview slice start. 2023-01-20 16:31:37 +11:00
objattrtuple.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objbool.c all: Rename UMODULE to MODULE in preprocessor/Makefile vars. 2023-06-08 17:54:11 +10:00
objboundmeth.c py/objboundmeth: Optimise check for types in binary_op. 2023-10-13 15:29:09 +11:00
objcell.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objclosure.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objcomplex.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objdeque.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objdict.c all: Rename UMODULE to MODULE in preprocessor/Makefile vars. 2023-06-08 17:54:11 +10:00
objenumerate.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objexcept.c py/mphal: Move configuration of ATOMIC_SECTION macros to mphal.h. 2023-12-01 14:14:08 +11:00
objexcept.h py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objfilter.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objfloat.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objfun.c py/misc: Change sizeof to offsetof for variable-length alloc. 2023-11-03 16:03:18 +11:00
objfun.h
objgenerator.c py/obj: Remove mp_generic_unary_op(). 2023-05-19 12:04:44 +10:00
objgenerator.h
objgetitemiter.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objint.c py/objint: Allow int() to parse anything with the buffer protocol. 2023-06-01 15:11:06 +10:00
objint.h
objint_longlong.c py: Change MP_UNARY_OP_INT to MP_UNARY_OP_INT_MAYBE. 2023-06-01 13:01:07 +10:00
objint_mpz.c py: Change MP_UNARY_OP_INT to MP_UNARY_OP_INT_MAYBE. 2023-06-01 13:01:07 +10:00
objlist.c all: Rename UMODULE to MODULE in preprocessor/Makefile vars. 2023-06-08 17:54:11 +10:00
objlist.h py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objmap.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objmodule.c py/makemoduledefs.py: Automatically declare delegation attr functions. 2023-06-14 19:03:46 +10:00
objmodule.h py/makemoduledefs.py: Automatically declare delegation attr functions. 2023-06-14 19:03:46 +10:00
objnamedtuple.c py/misc: Change sizeof to offsetof for variable-length alloc. 2023-11-03 16:03:18 +11:00
objnamedtuple.h py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objnone.c all: Rename UMODULE to MODULE in preprocessor/Makefile vars. 2023-06-08 17:54:11 +10:00
objobject.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objpolyiter.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objproperty.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objrange.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objreversed.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objset.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
objsingleton.c py/obj: Remove mp_generic_unary_op(). 2023-05-19 12:04:44 +10:00
objslice.c py/objslice: Validate that the argument to indices() is an integer. 2023-11-21 22:28:57 +11:00
objstr.c py/objstr: Fix `str % {}` edge case. 2023-09-01 14:31:57 +10:00
objstr.h py/objstr: Add a helper to set mp_obj_str_t data. 2022-10-11 17:50:19 +11:00
objstringio.c py/stream: Add mp_stream___exit___obj that calls mp_stream_close. 2023-07-21 18:49:03 +10:00
objstringio.h
objstrunicode.c all: Rename UMODULE to MODULE in preprocessor/Makefile vars. 2023-06-08 17:54:11 +10:00
objtuple.c py/misc: Change sizeof to offsetof for variable-length alloc. 2023-11-03 16:03:18 +11:00
objtuple.h
objtype.c py/misc: Change sizeof to offsetof for variable-length alloc. 2023-11-03 16:03:18 +11:00
objtype.h py/obj: Optimise code size and performance for make_new as a slot. 2022-09-19 19:06:16 +10:00
objzip.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
opmethods.c
pairheap.c
pairheap.h
parse.c py/parse: Always free lexer even if an exception is raised. 2023-09-14 13:03:31 +10:00
parse.h
parsenum.c py/parsenum: Fix typo in #endif comment. 2023-06-14 17:32:01 +10:00
parsenum.h
parsenumbase.c
parsenumbase.h
persistentcode.c py/qstr: Add support for sorted qstr pools. 2023-10-30 11:10:02 +11:00
persistentcode.h py/persistentcode: Bump .mpy sub-version. 2023-10-16 11:25:31 +11:00
profile.c py/profile: Remove the requirement to disable MICROPY_COMP_CONST. 2023-08-30 10:58:04 +10:00
profile.h
py.cmake all: Rename *umodule*.c to remove the "u" prefix. 2023-06-08 17:54:17 +10:00
py.mk py/py.mk: Remove extra build dir created for frozen_content. 2024-01-17 08:14:15 +11:00
pystack.c
pystack.h
qstr.c py/qstr: Add support for MICROPY_QSTR_BYTES_IN_HASH=0. 2024-01-25 16:38:17 +11:00
qstr.h py/qstr: Add support for MICROPY_QSTR_BYTES_IN_HASH=0. 2024-01-25 16:38:17 +11:00
qstrdefs.h
reader.c py/builtinevex: Handle invalid filenames for execfile. 2023-10-12 15:17:59 +11:00
reader.h py/builtinevex: Handle invalid filenames for execfile. 2023-10-12 15:17:59 +11:00
repl.c py/makemoduledefs.py: Add a way to register extensible built-in modules. 2023-06-08 17:54:21 +10:00
repl.h
ringbuf.c py/ringbuf: Implement put_bytes/get_bytes functions. 2023-05-01 16:47:03 +10:00
ringbuf.h py/ringbuf: Implement put_bytes/get_bytes functions. 2023-05-01 16:47:03 +10:00
runtime.c py/runtime: Remove declaration of function from inside function. 2023-11-03 15:21:51 +11:00
runtime.h py: Add port-agnostic inline functions for event handling. 2023-12-08 12:47:00 +11:00
runtime0.h py/dynruntime.h: Implement MP_OBJ_NEW_QSTR. 2023-09-01 16:14:22 +10:00
runtime_utils.c
scheduler.c py: Add port-agnostic inline functions for event handling. 2023-12-08 12:47:00 +11:00
scope.c
scope.h all: Fix spelling mistakes based on codespell check. 2023-04-27 18:03:06 +10:00
sequence.c all: Fix spelling mistakes based on codespell check. 2023-04-27 18:03:06 +10:00
showbc.c
smallint.c
smallint.h
stackctrl.c py/stackctrl: Add gcc pragmas to ignore dangling-pointer warning. 2023-05-04 10:08:12 +10:00
stackctrl.h
stream.c py/stream: Add mp_stream___exit___obj that calls mp_stream_close. 2023-07-21 18:49:03 +10:00
stream.h extmod/vfs_reader: Add file ioctl to set read buffer size. 2023-11-09 11:20:31 +11:00
unicode.c
unicode.h
usermod.cmake
vm.c py/vm: Don't emit warning when using "raise ... from None". 2023-10-09 09:46:02 +11:00
vmentrytable.h
vstr.c
warning.c