aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_json.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-05-21 23:36:32 +0200
committerJay Berkenbilt <ejb@ql.org>2022-05-21 23:36:32 +0200
commit752f43d4e4fc6348db63d17b1984116493cc5b2f (patch)
treeadc4919e9ce3468dbd0e5c46e59f519c22c2a0dc /libqpdf/QPDF_json.cc
parent62d47bff523ec6b64161651b33bb1563b6a80776 (diff)
downloadqpdf-752f43d4e4fc6348db63d17b1984116493cc5b2f.tar.zst
Allow empty b: binary JSON strings
Diffstat (limited to 'libqpdf/QPDF_json.cc')
-rw-r--r--libqpdf/QPDF_json.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/libqpdf/QPDF_json.cc b/libqpdf/QPDF_json.cc
index c6fab8ad..c2ebac06 100644
--- a/libqpdf/QPDF_json.cc
+++ b/libqpdf/QPDF_json.cc
@@ -128,7 +128,7 @@ is_binary_string(std::string const& v, std::string& str)
}
++count;
}
- return ((count > 0) && (count % 2 == 0));
+ return (count % 2 == 0);
}
return false;
}
@@ -180,10 +180,10 @@ QPDF::test_json_validators()
check(str == "");
check(!is_binary_string("", str));
check(!is_binary_string("x:", str));
- check(!is_binary_string("b:", str));
check(!is_binary_string("b:1", str));
check(!is_binary_string("b:123", str));
check(!is_binary_string("b:gh", str));
+ check(is_binary_string("b:", str));
check(is_binary_string("b:12", str));
check(is_binary_string("b:123aBC", str));
check(!is_name(""));