2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-05 03:40:53 +00:00

Allow empty b: binary JSON strings

This commit is contained in:
Jay Berkenbilt 2022-05-21 17:36:32 -04:00
parent 62d47bff52
commit 752f43d4e4
5 changed files with 15 additions and 11 deletions

View File

@ -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(""));

View File

@ -94,6 +94,7 @@
"u:one",
"b:24a2",
"u:",
"u:",
"u:()",
"u:(",
"u:)",

View File

@ -45,6 +45,7 @@
"u:one",
"b:24a2",
"u:",
"u:",
"u:()",
"u:(",
"u:)",

View File

@ -117,6 +117,7 @@
"/strings": [
"u:one",
"b:24a2",
"b:",
"u:",
"u:()",
"u:(",

View File

@ -47,6 +47,7 @@ endobj
(one)
<24a2>
()
()
(\(\))
(\()
(\))
@ -163,14 +164,14 @@ xref
0000000000 65535 f
0000000052 00000 n
0000000133 00000 n
0000000829 00000 n
0000000928 00000 n
0000001029 00000 n
0000001251 00000 n
0000001322 00000 n
0000001421 00000 n
0000001467 00000 n
0000001612 00000 n
0000000836 00000 n
0000000935 00000 n
0000001036 00000 n
0000001258 00000 n
0000001329 00000 n
0000001428 00000 n
0000001474 00000 n
0000001619 00000 n
trailer <<
/QTest 2 0 R
/Root 1 0 R
@ -178,5 +179,5 @@ trailer <<
/ID [<31415926535897932384626433832795><31415926535897932384626433832795>]
>>
startxref
1648
1655
%%EOF