summaryrefslogtreecommitdiff
path: root/tests/basics/bytearray_slice_assign.py
AgeCommit message (Collapse)Author
2024-04-22py/objarray: Fix use-after-free if extending a bytearray from itself.Angus Gratton
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>
2019-08-15py/objarray: Fix amount of free space in array when doing slice assign.Damien George
Prior to this patch the amount of free space in an array (including bytearray) was not being maintained correctly for the case of slice assignment which changed the size of the array. Under certain cases (as encoded in the new test) it was possible that the array could grow beyond its allocated memory block and corrupt the heap. Fixes issue #4127.
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2017-06-10tests/basics: Convert "sys.exit()" to "raise SystemExit".Paul Sokolovsky
2017-04-02tests/basics: Add tests for list and bytearray growing using themselves.Damien George
2016-03-14py/objarray: Fix array slice assignment when array is reallocated.Damien George
Addresses issue #1898.
2015-04-16objarray: Support assignment of bytes to bytearray slice.Paul Sokolovsky
2015-03-25tests: Add tests for SyntaxError, TypeError, and other missing things.Damien George
This is intended to improve coverage of the test suite.
2015-02-27tests: Add test for array slice assignment.Paul Sokolovsky