Concat data when push fails in the CFF compiler

This commit is contained in:
Calixte Denizet 2023-06-09 15:21:27 +02:00
parent f2a29e858f
commit 3d0ce1cff2
4 changed files with 14 additions and 5 deletions

View File

@ -1390,11 +1390,12 @@ class CFFCompiler {
data: [],
length: 0,
add(data) {
if (data.length <= 65536) {
// The number of arguments is limited, hence we just take 65536 as
// limit because it isn't too high or too low.
try {
// It's possible to exceed the call stack maximum size when trying
// to push too much elements.
// In case of failure, we fallback to the `concat` method.
this.data.push(...data);
} else {
} catch {
this.data = this.data.concat(data);
}
this.length = this.data.length;

View File

@ -598,3 +598,4 @@
!issue16473.pdf
!bug1529502.pdf
!issue16500.pdf
!issue16538.pdf

BIN
test/pdfs/issue16538.pdf Normal file

Binary file not shown.

View File

@ -7713,5 +7713,12 @@
"value": ["Three", "Five"]
}
}
}
},
{
"id": "issue16538",
"file": "pdfs/issue16538.pdf",
"md5": "35b691c3a343f4531bd287b001b67a77",
"rounds": 1,
"type": "eq"
}
]