Skip to content

Commit

Permalink
Allow other than /Yes and /Off in a check box (fixes qpdf#1056)
Browse files Browse the repository at this point in the history
  • Loading branch information
jberkenbilt committed Dec 22, 2023
1 parent b670565 commit 86ea201
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2023-12-22 Jay Berkenbilt <[email protected]>

* When setting a check box value, allow any value other than /Off
to mean checked. This is permitted by the spec. Previously, any
value other than /Yes or /Off was rejected. Fixes #1056.

2023-12-21 Jay Berkenbilt <[email protected]>

* Fix to QPDF JSON: a floating point number that appears in
Expand Down
8 changes: 4 additions & 4 deletions libqpdf/QPDFFormFieldObjectHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,10 @@ QPDFFormFieldObjectHelper::setV(QPDFObjectHandle value, bool need_appearances)
bool okay = false;
if (value.isName()) {
std::string name = value.getName();
if ((name == "/Yes") || (name == "/Off")) {
okay = true;
setCheckBoxValue((name == "/Yes"));
}
okay = true;
// Accept any value other than /Off to mean checked. Files have been seen that use
// /1 or other values.
setCheckBoxValue((name != "/Off"));
}
if (!okay) {
this->oh.warnIfPossible("ignoring attempt to set a checkbox field to a value of "
Expand Down
5 changes: 5 additions & 0 deletions manual/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ Planned changes for future 12.x (subject to change):
in scientific notation to fixed-point notation since PDF doesn't
accept scientific notation.

- When setting a check box value, allow any value other than
``/Off`` to mean checked. This is permitted by the spec.
Previously, any value other than ``/Yes`` or ``/Off`` was
rejected.

- Build Enhancements:

- The qpdf test suite now passes when qpdf is linked with an
Expand Down

0 comments on commit 86ea201

Please sign in to comment.