From 752f43d4e4fc6348db63d17b1984116493cc5b2f Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 21 May 2022 17:36:32 -0400 Subject: Allow empty b: binary JSON strings --- libqpdf/QPDF_json.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libqpdf/QPDF_json.cc') 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("")); -- cgit v1.2.3-54-g00ecf