The vulnerability, as described, is an infinite loop when parsing a malformed DCT inline image in a PDF. The provided patch in pull request #3501 directly addresses this issue. By analyzing the commits within this pull request, specifically commit 2abf4eb616de467f416aa8a88a2a111ba5fe0168, it's clear that the extract_inline_DCT function in pypdf/generic/_image_inline.py is the source of the vulnerability. The patch modifies this function to add proper end-of-stream checking. The while True loop in the original code is susceptible to an infinite loop if stream.read() consistently returns an empty byte string, which can happen with a crafted input. The fix involves creating a new read function that wraps stream.read() and raises an exception if an unexpected end of the stream is detected, thus preventing the infinite loop. Therefore, extract_inline_DCT is the vulnerable function that would appear in a runtime profile during the exploitation of this vulnerability.
extract_inline_DCTpypdf/generic/_image_inline.py
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| pypdf | pip | < 6.1.3 | 6.1.3 |
Ongoing coverage of React2Shell