bz2.BZ2Decompressor objects could be reused after a decompression error. If an application caught the resulting OSError and retried with the same decompressor, crafted input could cause the decompressor to resume from an invalid internal state and perform out-of-bounds writes to a stack buffer. This could crash the process when processing untrusted data.
`Element.findall()` and fully-consumed `Element.iterfind()` exhibit `O(n^2)` time complexity when using XPath index predicates (e.g. `[1]`, `[last()]`, `[last()-N]`) on XML documents with many same-tag siblings. `Element.find()` is only affected when the first match is near the end of the sibling list, such as with `[last()]` or `[last()-N]`; `.//item[1]` short-circuits after the first match.
Use-after-free (UAF) was possible in the `lzma.LZMADecompressor`, `bz2.BZ2Decompressor`, and `gzip.GzipFile` when a memory allocation fails with a `MemoryError` and the decompression instance is re-used. This scenario can be triggered if the process is under memory pressure. The fix cleans up the dangling pointer in this specific error condition. The vulnerability is only present if the program re-uses decompressor instances across multiple decompression calls even after a `MemoryError` is raised during decompression. Using the helper functions to one-shot decompress data such as `lzma.decompress()`, `bz2.decompress()`, `gzip.decompress()`, and `zlib.decompress()` are not affected as a new decompressor instance is used per call. If the decompressor instance is not re-used after an error condition, this usage is similarly not vulnerable.
| Version | Type | Source | Base | Exp | Imp |
|---|---|---|---|---|---|
| 3.1 | Primary | cve.org | 8.1 | — | — |
| 3.1 | Primary | cve.org | 8.1 | — | — |
| 3.1 | Primary | cve.org | 8.1 | — | — |
| 3.1 | Primary | cve.org | 8.1 | — | — |
| 3.1 | Primary | cve.org | 8.1 | — | — |
| 3.1 | Primary | cve.org | 8.1 | — | — |
| 3.1 | Secondary | NVD | 8.1 | 2.2 | 5.9 |
| 4.0 | Primary | cve.org | 9.1 | — | — |
| 4.0 | Secondary | NVD | 9.1 | — | — |
| 4.0 | Secondary | ENISA EUVD | 9.1 | — | — |