Commit 86ea2012bd413e728c2a3eecf5f2a6de113e3679

Authored by Jay Berkenbilt
1 parent b670565a

Allow other than /Yes and /Off in a check box (fixes #1056)

ChangeLog
  1 +2023-12-22 Jay Berkenbilt <ejb@ql.org>
  2 +
  3 + * When setting a check box value, allow any value other than /Off
  4 + to mean checked. This is permitted by the spec. Previously, any
  5 + value other than /Yes or /Off was rejected. Fixes #1056.
  6 +
1 2023-12-21 Jay Berkenbilt <ejb@ql.org> 7 2023-12-21 Jay Berkenbilt <ejb@ql.org>
2 8
3 * Fix to QPDF JSON: a floating point number that appears in 9 * Fix to QPDF JSON: a floating point number that appears in
libqpdf/QPDFFormFieldObjectHelper.cc
@@ -304,10 +304,10 @@ QPDFFormFieldObjectHelper::setV(QPDFObjectHandle value, bool need_appearances) @@ -304,10 +304,10 @@ QPDFFormFieldObjectHelper::setV(QPDFObjectHandle value, bool need_appearances)
304 bool okay = false; 304 bool okay = false;
305 if (value.isName()) { 305 if (value.isName()) {
306 std::string name = value.getName(); 306 std::string name = value.getName();
307 - if ((name == "/Yes") || (name == "/Off")) {  
308 - okay = true;  
309 - setCheckBoxValue((name == "/Yes"));  
310 - } 307 + okay = true;
  308 + // Accept any value other than /Off to mean checked. Files have been seen that use
  309 + // /1 or other values.
  310 + setCheckBoxValue((name != "/Off"));
311 } 311 }
312 if (!okay) { 312 if (!okay) {
313 this->oh.warnIfPossible("ignoring attempt to set a checkbox field to a value of " 313 this->oh.warnIfPossible("ignoring attempt to set a checkbox field to a value of "
manual/release-notes.rst
@@ -56,6 +56,11 @@ Planned changes for future 12.x (subject to change): @@ -56,6 +56,11 @@ Planned changes for future 12.x (subject to change):
56 in scientific notation to fixed-point notation since PDF doesn't 56 in scientific notation to fixed-point notation since PDF doesn't
57 accept scientific notation. 57 accept scientific notation.
58 58
  59 + - When setting a check box value, allow any value other than
  60 + ``/Off`` to mean checked. This is permitted by the spec.
  61 + Previously, any value other than ``/Yes`` or ``/Off`` was
  62 + rejected.
  63 +
59 - Build Enhancements: 64 - Build Enhancements:
60 65
61 - The qpdf test suite now passes when qpdf is linked with an 66 - The qpdf test suite now passes when qpdf is linked with an