Skip to content

Commit aee4f2d

Browse files
authored
Merge pull request #20113 from calixteman/bug1978317
Fix the xref table with the values we've at the beginning of a xref stream (bug 1978317)
2 parents bfc2025 + 78391ed commit aee4f2d

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

src/core/xref.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,15 @@ class XRef {
961961
);
962962
}
963963
nums[i] = num;
964+
965+
// The entry in the xref table is the object number followed by the index.
966+
// So if index (gen number) is not the same as the index (i), we fix it
967+
// (fixes bug 1978317).
968+
const entry = this.getEntry(num);
969+
if (entry?.offset === tableOffset && entry.gen !== i) {
970+
entry.gen = i;
971+
}
972+
964973
offsets[i] = offset;
965974
}
966975

test/pdfs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,3 +735,4 @@
735735
!issue20102.pdf
736736
!issue20065.pdf
737737
!bug1708041.pdf
738+
!bug1978317.pdf

test/pdfs/bug1978317.pdf

1.46 MB
Binary file not shown.

test/test_manifest.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12221,5 +12221,12 @@
1222112221
"rounds": 1,
1222212222
"disableFontFace": true,
1222312223
"type": "eq"
12224+
},
12225+
{
12226+
"id": "bug1978317",
12227+
"file": "pdfs/bug1978317.pdf",
12228+
"md5": "ae4f643ee9bb0fd725277a9d1e0fb1df",
12229+
"rounds": 1,
12230+
"type": "load"
1222412231
}
1222512232
]

0 commit comments

Comments
 (0)