Highlights
Memory Corruption: 5 prior fixes. Scrutinize any change in this area.
bitarray/_bitarray.c: most-fixed (6 issues). Treat as high-risk during review.
8 high-severity fixes in this history; regressions here are high-impact.
Recurring patterns
The bug types that recur here, drawn from past fixes, not open vulnerabilities.
Memory Corruption: The `resize` function has been a recurring source of memory corruption due to integer overflows when processing extremely large sizes or repeat operations, particularly on 32-bit systems. Failure to properly validate size arguments before adjusting buffer structures can lead to heap buffer overflows.
Integer Overflow: The `BYTES` macro calculation in `newbitarrayobject` can experience arithmetic overflows during initialization from large indices or resize requests, allowing heap allocations of insufficient sizes.
Buffer Overflow: Logic flaws in checking state constraints during resize, such as bypassing negative size or exported buffer validation when the calculated byte size matches the current byte size, expose the buffer to invalid memory accesses.