Fix the xref table with the values we've at the beginning of a xref stream (bug 1978317)

This commit is contained in:
Calixte Denizet 2025-07-21 18:59:17 +02:00
parent bfc20250b2
commit 78391ed85a
4 changed files with 17 additions and 0 deletions

View File

@ -961,6 +961,15 @@ class XRef {
);
}
nums[i] = num;
// The entry in the xref table is the object number followed by the index.
// So if index (gen number) is not the same as the index (i), we fix it
// (fixes bug 1978317).
const entry = this.getEntry(num);
if (entry?.offset === tableOffset && entry.gen !== i) {
entry.gen = i;
}
offsets[i] = offset;
}

View File

@ -735,3 +735,4 @@
!issue20102.pdf
!issue20065.pdf
!bug1708041.pdf
!bug1978317.pdf

BIN
test/pdfs/bug1978317.pdf Executable file

Binary file not shown.

View File

@ -12221,5 +12221,12 @@
"rounds": 1,
"disableFontFace": true,
"type": "eq"
},
{
"id": "bug1978317",
"file": "pdfs/bug1978317.pdf",
"md5": "ae4f643ee9bb0fd725277a9d1e0fb1df",
"rounds": 1,
"type": "load"
}
]