1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Don't cache free/missing XRef entries (issue 19510)

During the XRef stream parsing we're attempting to lookup an entry that hasn't yet been found, since parsing is currently running, and given that we'd also cache free/missing XRef entries we'd then return an incorrect value during normal PDF parsing.

The simplest solution here is to just not cache free/missing XRef entries, since a properly generated PDF document shouldn't be trying to access objects it doesn't contain.
Furthermore, the amount of "extra" parsing now needed for such XRef entries shouldn't be significant enough to be an issue.
This commit is contained in:
Jonas Jenwald 2025-02-18 17:53:36 +01:00
parent 426c730e11
commit db7cf40a30
3 changed files with 9 additions and 1 deletions

View file

@ -842,7 +842,6 @@ class XRef {
if (xrefEntry === null) {
// The referenced entry can be free.
this._cacheMap.set(num, xrefEntry);
return xrefEntry;
}
// Prevent circular references, in corrupt PDF documents, from hanging the