summaryrefslogtreecommitdiff
path: root/tests/basics/bytearray_construct.py
diff options
context:
space:
mode:
authorSimon Arlott <sa.me.uk>2022-11-01 18:44:23 +0000
committerDamien George <damien@micropython.org>2022-11-08 23:03:21 +1100
commitf8b0ae32d31cfb95db4294c43b821c205c17e1d3 (patch)
tree4b374053ff540b92c5410da88f4da180944908a7 /tests/basics/bytearray_construct.py
parent43dd3ea74dad79dc144d03a1caba8a4f220a5b27 (diff)
py/builtinimport: Fix crash handling "weak link" module names.
There are two calls to mp_builtin___import__(): 1. ports/unix/main.c:main_() which provides a str in args[0] 2. py/runtime.c:mp_import_name() which provides a qstr in args[0] The default implementation of mp_builtin___import__() is mp_builtin___import___default() which has a different implementation based on MICROPY_ENABLE_EXTERNAL_IMPORT. If MICROPY_ENABLE_EXTERNAL_IMPORT is disabled then the handling of weak links assumes that args[0] is a `const char *`, when it is either a str or qstr object. Use the existing qstr of the module name instead, and also use a vstr instead of strcpy() to ensure no overflow occurs.
Diffstat (limited to 'tests/basics/bytearray_construct.py')
0 files changed, 0 insertions, 0 deletions