Author tholl
Recipients tholl
Date 2021-01-13.11:26:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610537215.58.0.240765902048.issue42924@roundup.psfhosted.org>
In-reply-to
Content
`bytearray_repeat` uses `ob_bytes` rather than `ob_start` as its source data for copying, leading to incorrect results in some edge cases where the two are distinct. It should probably use `PyByteArray_AS_STRING(self)` just like `bytearray_irepeat` and basically all the other functions.

As far as I can see, these edge cases occur pretty much only after `bytearray_setslice_linear`, where `ob_start` can be adjusted without changing `ob_bytes`. 

A simple example (also attached as poc.py):

>>> ba = bytearray(b'0123456789abcdef')
>>> ba[:10] = b'test'
>>> print(ba)
bytearray(b'testabcdef')
>>> print(ba * 1)
bytearray(b'012345test')

I'll try to submit a PR for this later today.
History
Date User Action Args
2021-01-13 11:26:55thollsetrecipients: + tholl
2021-01-13 11:26:55thollsetmessageid: <1610537215.58.0.240765902048.issue42924@roundup.psfhosted.org>
2021-01-13 11:26:55tholllinkissue42924 messages
2021-01-13 11:26:55thollcreate