aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2023-12-22 20:42:16 +0100
committerJay Berkenbilt <ejb@ql.org>2023-12-22 20:42:16 +0100
commit86ea2012bd413e728c2a3eecf5f2a6de113e3679 (patch)
tree897c40e7ba211142381ba221da97868fd6a751a4
parentb670565abc579de5bda946b7538545aa967e6cd2 (diff)
downloadqpdf-86ea2012bd413e728c2a3eecf5f2a6de113e3679.tar.zst
Allow other than /Yes and /Off in a check box (fixes #1056)
-rw-r--r--ChangeLog6
-rw-r--r--libqpdf/QPDFFormFieldObjectHelper.cc8
-rw-r--r--manual/release-notes.rst5
3 files changed, 15 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index b267f4f6..b18283cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-12-22 Jay Berkenbilt <ejb@ql.org>
+
+ * 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 <ejb@ql.org>
* Fix to QPDF JSON: a floating point number that appears in
diff --git a/libqpdf/QPDFFormFieldObjectHelper.cc b/libqpdf/QPDFFormFieldObjectHelper.cc
index 4f7ca0e1..371ed271 100644
--- a/libqpdf/QPDFFormFieldObjectHelper.cc
+++ b/libqpdf/QPDFFormFieldObjectHelper.cc
@@ -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 "
diff --git a/manual/release-notes.rst b/manual/release-notes.rst
index 2fdd197f..7aa625ab 100644
--- a/manual/release-notes.rst
+++ b/manual/release-notes.rst
@@ -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