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

Merge pull request #13527 from calixteman/bind_inf_loop

XFA - Avoid infinite loop when creating some nodes in data
This commit is contained in:
Brendan Dahl 2021-06-09 12:37:29 -07:00 committed by GitHub
commit d333af7848
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 2 deletions

View file

@ -526,7 +526,10 @@ class Binder {
if (this._isConsumeData()) {
match[$consumed] = true;
}
match = [match];
// Don't bind the value in newly created node because it's empty.
this._bindElement(child, match);
continue;
} else {
if (this._isConsumeData()) {
// Filter out consumed nodes.

View file

@ -245,7 +245,7 @@ function searchNode(
function createNodes(root, path) {
let node = null;
for (const { name, index } of path) {
for (let i = 0; i <= index; i++) {
for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
node = new XmlObject(root[$namespaceId], name);
root[$appendChild](node);
}