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

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;