mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibPDF: Require whitespace in front of inline image marker EI
Fixes a crash on page 3 of 0000450.pdf of 0000.zip, where we previously started interpreting the middle of an inline image content stream as operators, since it contained `EI` in its pixel data.
This commit is contained in:
parent
27aae7e2b1
commit
071f890847
1 changed files with 4 additions and 3 deletions
|
@ -559,12 +559,13 @@ PDFErrorOr<Vector<Operator>> Parser::parse_operators()
|
|||
// FIXME: Check for ASCIIHexDecode and ASCII85Decode.
|
||||
m_reader.consume(1);
|
||||
|
||||
// FIXME: `EI` can be part of the image data, e.g. on page 3 of 0000450.pdf of 0000.zip of the RGBA dataset.
|
||||
while (!m_reader.done()) {
|
||||
if (m_reader.matches("EI")) {
|
||||
// FIXME: Should we allow EI after matches_delimiter() too?
|
||||
bool expecting_ei = m_reader.matches_whitespace();
|
||||
m_reader.consume();
|
||||
if (expecting_ei && m_reader.matches("EI")) {
|
||||
break;
|
||||
}
|
||||
m_reader.consume();
|
||||
}
|
||||
|
||||
if (m_reader.done())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue