Repository navigation
Discard the state of a corrupt XRef table/stream before parsing the next one - #22375
Conversation
421f5e8 to
2d3f884
Compare
11fad16 to
7075a48
Compare
Snuffleupagus
left a comment
There was a problem hiding this comment.
Assuming that it passes all tests, this is probably a generally reasonable change.
7075a48 to
6c51707
Compare
Viewer preview🗑️ Viewer previews removed. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #22375 +/- ##
==========================================
- Coverage 90.58% 90.58% -0.01%
==========================================
Files 278 278
Lines 68573 68586 +13
==========================================
+ Hits 62117 62126 +9
- Misses 6456 6460 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will improve performance by 16.28%
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
Reference testsResults for 4794c39 (run, references from mozilla/pdf.js.refs@46378a2139).
The report is kept for 30 days and replaced by the next run. |
|
The commits must be squashed (and merge commits aren't allowed in PRs). |
…ext one The state of an XRef table/stream is kept, so that parsing can resume after a `MissingDataException`. However, when parsing failed for any other reason the state was left behind and then used for the next XRef table/stream. In a linearized file where the linearization dictionary and the first-page XRef stream were overwritten, `startxref` points to the hint stream which is parsed as an XRef stream and fails, since it has no /W entry. The main XRef stream was then read with the hint stream's state and failed as well, which lost all of its compressed entries, hence "Invalid Root reference." even in recovery mode.
73dcd4d to
4794c39
Compare
Fixes #22370
The state of an XRef table/stream is kept, so that parsing can resume after a
MissingDataException. However, when parsing failed for any other reason the state was left behind and then used for the next XRef table/stream.In a linearized file where the linearization dictionary and the first-page XRef stream were overwritten,
startxrefpoints to the hint stream which is parsed as an XRef stream and fails, since it has no /W entry. The main XRef stream was then read with the hint stream's state and failed as well, which lost all of its compressed entries, hence "Invalid Root reference." even in recovery mode.The new unit test reproduces this with
issue22370.pdf, which isempty.pdfwith its linearization dictionary and first-page XRef stream overwritten by spaces. It fails onmasterwith "Invalid Root reference." and passes with this patch.