mirror of
https://pdfium.googlesource.com/pdfium
synced 2026-08-02 05:04:39 +08:00
PDF-1.7 calls out no bytes other than whitespace when specifying what can occur between endstream and endobj, so whitespace needs to be handled. When CPDF_SyntaxParser::ReadStream() reads the stream, it reads 'endobj', and then resets the position back to the end of 'endstream'. This mechanism is disabled in case there is whitespace between the tokens and the newline, see the end of the function. This results in reporting no trailer ends, as the parsing fails, as the next token is expected to be 'endobj', but it's the ID of the next object instead. Fix the problem by handling whitespace in CPDF_SyntaxParser::ReadStream() where it was looking for \ntoken\n, not allowing whitespace between the token and the following newline. Change-Id: I7048e8d081af04af3dd08d957212c885b7982b5e Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/76850 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
87 lines
1.1 KiB
Plaintext
87 lines
1.1 KiB
Plaintext
{{header}}
|
|
{{object 1 0}} <<
|
|
/Type /Catalog
|
|
/Pages 2 0 R
|
|
>>
|
|
endobj
|
|
{{object 2 0}} <<
|
|
/Type /Pages
|
|
/MediaBox [0 0 200 200]
|
|
/Count 1
|
|
/Kids [3 0 R]
|
|
>>
|
|
endobj
|
|
{{object 3 0}} <<
|
|
/Type /Page
|
|
/Parent 2 0 R
|
|
/Resources <<
|
|
/Font <<
|
|
/F1 4 0 R
|
|
/F2 5 0 R
|
|
>>
|
|
>>
|
|
/Contents 6 0 R
|
|
>>
|
|
endobj
|
|
{{object 4 0}} <<
|
|
/Type /Font
|
|
/Subtype /Type1
|
|
/BaseFont /Times-Roman
|
|
>>
|
|
endobj
|
|
% Single space after endstream and endobj.
|
|
{{object 6 0}} <<
|
|
{{streamlen}}
|
|
>>
|
|
stream
|
|
BT
|
|
20 50 Td
|
|
/F1 12 Tf
|
|
(Hello, world!) Tj
|
|
0 50 Td
|
|
/F2 16 Tf
|
|
(Goodbye, world!) Tj
|
|
ET
|
|
endstream
|
|
endobj
|
|
% Multiple spaces after endstream and endobj.
|
|
{{object 6 0}} <<
|
|
{{streamlen}}
|
|
>>
|
|
stream
|
|
BT
|
|
20 50 Td
|
|
/F1 12 Tf
|
|
(Hello, world!) Tj
|
|
0 50 Td
|
|
/F2 16 Tf
|
|
(Goodbye, world!) Tj
|
|
ET
|
|
endstream
|
|
endobj
|
|
% Tab after endstream and endobj.
|
|
{{object 6 0}} <<
|
|
{{streamlen}}
|
|
>>
|
|
stream
|
|
BT
|
|
20 50 Td
|
|
/F1 12 Tf
|
|
(Hello, world!) Tj
|
|
0 50 Td
|
|
/F2 16 Tf
|
|
(Goodbye, world!) Tj
|
|
ET
|
|
endstream
|
|
endobj
|
|
{{object 5 0}} <<
|
|
/Type /Font
|
|
/Subtype /Type1
|
|
/BaseFont /Helvetica
|
|
>>
|
|
endobj
|
|
{{xref}}
|
|
{{trailer}}
|
|
{{startxref}}
|
|
%%EOF
|