Wykres commitów

3 Commity (master)

Autor SHA1 Wiadomość Data
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
Damien George 1d350b8ac6 tests: Add a few tests for bool, bytearray, float to improve coverage. 2015-08-29 23:13:28 +01:00
Damien George b2e731177e py: Implement +, += and .extend for bytearray and array objs.
Addresses issue #994.
2014-11-30 00:00:55 +00:00