Compare commits

...

4 Commits

Author SHA1 Message Date
calixteman
ca05a0dbfc
Merge pull request #19911 from calixteman/issue19753
Decode appearance keys of checkboxes
2025-05-10 15:01:22 +02:00
Jonas Jenwald
5f4bfe1fb9
Merge pull request #19913 from Snuffleupagus/openAction-array-validate
Improve validation in the `Catalog.prototype.openAction` getter
2025-05-10 14:53:48 +02:00
Jonas Jenwald
f26f984fa0 Improve validation in the Catalog.prototype.openAction getter
When the /OpenAction data is an Array we're currently using it as-is which could theoretically cause problems in corrupt PDF documents, hence we ensure that a "raw" destination is actually valid. (This change is covered by existing unit-tests.)

*Note:* In the Dictionary case we're using the `Catalog.parseDestDictionary` method, which already handles all of the necessary validation.
2025-05-10 11:51:58 +02:00
Calixte Denizet
49a098cb5d Decode appearance keys of checkboxes 2025-05-09 21:46:17 +02:00
4 changed files with 12 additions and 2 deletions

View File

@ -3290,7 +3290,7 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
? this.data.fieldValue
: "Yes";
const exportValues = normalAppearance.getKeys();
const exportValues = this._decodeFormValue(normalAppearance.getKeys());
if (exportValues.length === 0) {
exportValues.push("Off", yes);
} else if (exportValues.length === 1) {

View File

@ -1029,7 +1029,7 @@ class Catalog {
} else if (resultObj.action) {
openAction.action = resultObj.action;
}
} else if (Array.isArray(obj)) {
} else if (isValidExplicitDest(obj)) {
openAction.dest = obj;
}
return shadow(

View File

@ -0,0 +1 @@
https://github.com/user-attachments/files/19566810/PDFjs_fails_checkboxState.pdf

View File

@ -12114,5 +12114,14 @@
"md5": "2abe67c8b34522feb6b85d252dde9d3e",
"rounds": 1,
"type": "eq"
},
{
"id": "issue19753",
"file": "pdfs/issue19753.pdf",
"md5": "6b1fe0af506860002a9411f5f0d6437f",
"rounds": 1,
"type": "eq",
"forms": true,
"link": true
}
]