micropython/py
Angus Gratton 4bed614e70 py/objarray: Fix use-after-free if extending a bytearray from itself.
Two cases, one assigning to a slice.
Closes https://github.com/micropython/micropython/issues/13283

Second is extending a slice from itself, similar logic.

In both cases the problem occurs when m_renew causes realloc to move the
buffer, leaving a dangling pointer behind.

There are more complex and hard to fix cases when either argument is a
memoryview into the buffer, currently resizing to a new address breaks
memoryviews into that object.

Reproducing this bug and confirming the fix was done by running the unix
port under valgrind with GC-aware extensions.

Note in default configurations with GIL this bug exists but has no impact
(the free buffer won't be reused while the function is still executing, and
is no longer referenced after it returns).

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-04-22 11:50:52 +10:00
..
argcheck.c
asmarm.c
asmarm.h
asmbase.c
asmbase.h
asmthumb.c
asmthumb.h
asmx64.c
asmx64.h
asmx86.c
asmx86.h
asmxtensa.c
asmxtensa.h
bc.c
bc.h
bc0.h
binary.c
binary.h
builtin.h
builtinevex.c
builtinhelp.c
builtinimport.c
compile.c py/compile: Add option to allow compiling top-level await. 2024-03-22 13:05:25 +11:00
compile.h py/compile: Add option to allow compiling top-level await. 2024-03-22 13:05:25 +11:00
dynruntime.h py/dynruntime: Add mp_binary_get_size/get_val_array/set_val_array. 2024-03-28 16:18:09 +11:00
dynruntime.mk
emit.h
emitbc.c
emitcommon.c
emitglue.c
emitglue.h
emitinlinethumb.c
emitinlinextensa.c
emitnarm.c
emitnative.c
emitnthumb.c
emitnx64.c
emitnx86.c
emitnxtensa.c
emitnxtensawin.c
formatfloat.c
formatfloat.h
frozenmod.c
frozenmod.h
gc.c
gc.h
grammar.h
lexer.c
lexer.h
make_root_pointers.py
makecompresseddata.py
makemoduledefs.py
makeqstrdata.py py/makeqstrdata.py: Ensure that scope names get low qstr values. 2024-03-26 22:52:25 +11:00
makeqstrdefs.py
makeversionhdr.py
malloc.c
map.c
misc.h
mkenv.mk
mkrules.cmake
mkrules.mk
modarray.c
modbuiltins.c
modcmath.c
modcollections.c
moderrno.c
modgc.c
modio.c
modmath.c
modmicropython.c
modstruct.c
modsys.c
modthread.c
mpconfig.h py/compile: Add option to allow compiling top-level await. 2024-03-22 13:05:25 +11:00
mperrno.h
mphal.h
mpprint.c
mpprint.h
mpstate.c
mpstate.h
mpthread.h
mpz.c
mpz.h
nativeglue.c py/dynruntime: Add mp_binary_get_size/get_val_array/set_val_array. 2024-03-28 16:18:09 +11:00
nativeglue.h py/dynruntime: Add mp_binary_get_size/get_val_array/set_val_array. 2024-03-28 16:18:09 +11:00
nlr.c
nlr.h
nlraarch64.c py/nlr: Add "memory" to asm clobbers list in nlr_jump. 2024-03-25 11:52:26 +11:00
nlrmips.c py/nlr: Add "memory" to asm clobbers list in nlr_jump. 2024-03-25 11:52:26 +11:00
nlrpowerpc.c py/nlr: Add "memory" to asm clobbers list in nlr_jump. 2024-03-25 11:52:26 +11:00
nlrsetjmp.c
nlrthumb.c py/nlr: Add "memory" to asm clobbers list in nlr_jump. 2024-03-25 11:52:26 +11:00
nlrx64.c py/nlr: Add "memory" to asm clobbers list in nlr_jump. 2024-03-25 11:52:26 +11:00
nlrx86.c py/nlr: Add "memory" to asm clobbers list in nlr_jump. 2024-03-25 11:52:26 +11:00
nlrxtensa.c py/nlr: Add "memory" to asm clobbers list in nlr_jump. 2024-03-25 11:52:26 +11:00
obj.c
obj.h py/obj: Fix initialiser order in MP_DEFINE_CONST_OBJ_TYPE_NARGS_ macros. 2024-04-22 11:10:23 +10:00
objarray.c py/objarray: Fix use-after-free if extending a bytearray from itself. 2024-04-22 11:50:52 +10:00
objarray.h
objattrtuple.c
objbool.c
objboundmeth.c
objcell.c
objclosure.c
objcomplex.c
objdeque.c
objdict.c
objenumerate.c
objexcept.c
objexcept.h
objfilter.c
objfloat.c
objfun.c
objfun.h py/objfun: Fix C++ compatibility with casting in inline functions. 2024-04-22 10:34:01 +10:00
objgenerator.c
objgenerator.h
objgetitemiter.c
objint.c
objint.h
objint_longlong.c
objint_mpz.c
objlist.c
objlist.h
objmap.c
objmodule.c
objmodule.h
objnamedtuple.c
objnamedtuple.h
objnone.c
objobject.c
objpolyiter.c
objproperty.c
objrange.c
objreversed.c
objset.c
objsingleton.c
objslice.c
objstr.c
objstr.h
objstringio.c
objstringio.h
objstrunicode.c
objtuple.c
objtuple.h
objtype.c py/makeqstrdata.py: Ensure that scope names get low qstr values. 2024-03-26 22:52:25 +11:00
objtype.h
objzip.c
opmethods.c
pairheap.c
pairheap.h
parse.c
parse.h
parsenum.c
parsenum.h
parsenumbase.c
parsenumbase.h
persistentcode.c
persistentcode.h py/persistentcode: Bump .mpy sub-version to 6.3. 2024-03-28 16:18:26 +11:00
profile.c
profile.h
py.cmake
py.mk
pystack.c
pystack.h
qstr.c py/makeqstrdata.py: Ensure that scope names get low qstr values. 2024-03-26 22:52:25 +11:00
qstr.h
qstrdefs.h
reader.c
reader.h
repl.c
repl.h
ringbuf.c
ringbuf.h
runtime.c
runtime.h
runtime0.h
runtime_utils.c
scheduler.c
scope.c py/makeqstrdata.py: Ensure that scope names get low qstr values. 2024-03-26 22:52:25 +11:00
scope.h
sequence.c
showbc.c
smallint.c
smallint.h
stackctrl.c
stackctrl.h
stream.c
stream.h
unicode.c
unicode.h
usermod.cmake
vm.c
vmentrytable.h
vstr.c
warning.c