Skip to content

Commit

Permalink
Merge pull request #15170 from calixteman/js_rm_null
Browse files Browse the repository at this point in the history
[JS] Embedded JS scripts can have some null chars
  • Loading branch information
Snuffleupagus authored Jul 15, 2022
2 parents 75b8647 + 5f0c95e commit de7d1d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/core/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,8 @@ class Catalog {
if (javaScript === null) {
javaScript = new Map();
}
javaScript.set(name, stringToPDFString(js));
js = stringToPDFString(js).replace(/\u0000/g, "");
javaScript.set(name, js);
}

if (obj instanceof Dict && obj.has("JavaScript")) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/core_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ function _collectJS(entry, xref, list, parents) {
} else if (typeof js === "string") {
code = js;
}
code = code && stringToPDFString(code);
code = code && stringToPDFString(code).replace(/\u0000/g, "");
if (code) {
list.push(code);
}
Expand Down

0 comments on commit de7d1d2

Please sign in to comment.