1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Let Lexer.prototype.getNumber treat more cases of a single minus sign as zero (bug 1953099)

This patch extends the approach of PR 14543, by also treating e.g. minus signs followed by '(' or '<' as zero.
Inside of a /Contents stream those characters will generally mean the start of one or more glyphs.
This commit is contained in:
Jonas Jenwald 2025-03-12 16:35:37 +01:00
parent d74619847d
commit ee34c5c648
5 changed files with 27 additions and 3 deletions

View file

@ -16,6 +16,7 @@
!bug1727053.pdf
!issue18408_reduced.pdf
!bug1907000_reduced.pdf
!bug1953099.pdf
!issue11913.pdf
!issue2391-1.pdf
!issue2391-2.pdf

BIN
test/pdfs/bug1953099.pdf Normal file

Binary file not shown.

View file

@ -10414,6 +10414,14 @@
"link": true,
"type": "eq"
},
{
"id": "bug1953099",
"file": "pdfs/bug1953099.pdf",
"md5": "15295cfa4999ccc08442423fca96c28f",
"rounds": 1,
"link": false,
"type": "eq"
},
{
"id": "bug1899804_print",
"file": "pdfs/bug1899804.pdf",

View file

@ -152,7 +152,17 @@ describe("parser", function () {
});
it("should treat a single decimal point, or minus/plus sign, as zero", function () {
const validNums = [".", "-", "+", "-.", "+.", "-\r\n.", "+\r\n."];
const validNums = [
".",
"-",
"+",
"-.",
"+.",
"-\r\n.",
"+\r\n.",
"-(",
"-<",
];
for (const number of validNums) {
const validInput = new StringStream(number);
const validLexer = new Lexer(validInput);