[issue46997] Invalid memory write in bytearray

2022-03-12 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: 3.9 segfaults. (gdb) bt #0 bytearray_ass_subscript (self=, index=0x77e118f0, values=0x76f918b0) at Objects/bytearrayobject.c:640 #1 0x00536302 in _PyEval_EvalFrameDefault (tstate=, f=0x999a80, throwflag=) at Python/ceval.c:1990 #2 0x00

[issue46997] Invalid memory write in bytearray

2022-03-12 Thread Jelle Zijlstra
Change by Jelle Zijlstra : -- components: +Interpreter Core versions: +Python 3.10, Python 3.11 ___ Python tracker ___ ___ Python-bu

[issue46997] Invalid memory write in bytearray

2022-03-12 Thread Jelle Zijlstra
New submission from Jelle Zijlstra : Inspired by Guido's comment in https://github.com/python/cpython/pull/31834/files#r825352900, I found that there are some places in bytearrayobject.c where we can write to free'd memory if we encounter an object with a sneaky __index__ method: $ cat basne