summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViktor Rosendahl <viktor.rosendahl@bmw.de>2023-04-27 21:56:44 +0530
committerArmin Kuster <akuster808@gmail.com>2023-05-05 07:20:59 -0400
commit765cfa779db64fc5b71faef1e78f902fa5c200d0 (patch)
tree13f0d68a77c45c508387ade07cd2bb9e5efb20f9
parent34f5646bba98b909d44e3bf29cd8853199b8197a (diff)
downloadmeta-openembedded-765cfa779db64fc5b71faef1e78f902fa5c200d0.tar.gz
jsoncpp: Fix broken handling of escape characters
Applying this backported patch from upstream fixes the following BAT test failure: jsoncpp.jsoncpp_system_tests.TestJsoncpp.test_run_jsoncpp_test (from systemtests--bmt--BAT) : * Detail of EscapeSequenceTest/writeEscapeSequence test failure: /usr/src/debug/jsoncpp/1.9.2-r0/git/src/test_lib_json/main.cpp(3370): expected == result Expected: '["\"","\\","\b","\f","\n","\r","\t","\u0278","\ud852\udf62"] ' Actual : '["\"","\\","\b","\f","\n","\r","\t","ɸ","𤭢"] This test failure happens because aarch64 uses unsigned char as default type for char, while x86 uses signed char. Also, there is another bug in the code that is fixed by this upstream patch: "static_cast<unsigned char>(*cur) < 0x80" should be: "static_cast<unsigned char>(*cur) >= 0x80" Signed-off-by: Ranjitsinh Rathod <ranjitsinhrathod1991@gmail.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-oe/recipes-devtools/jsoncpp/jsoncpp/0001-json_writer-fix-inverted-sense-in-isAnyCharRequiredQ.patch52
-rw-r--r--meta-oe/recipes-devtools/jsoncpp/jsoncpp_1.9.2.bb5
2 files changed, 56 insertions, 1 deletions
diff --git a/meta-oe/recipes-devtools/jsoncpp/jsoncpp/0001-json_writer-fix-inverted-sense-in-isAnyCharRequiredQ.patch b/meta-oe/recipes-devtools/jsoncpp/jsoncpp/0001-json_writer-fix-inverted-sense-in-isAnyCharRequiredQ.patch
new file mode 100644
index 0000000000..784f175eea
--- /dev/null
+++ b/meta-oe/recipes-devtools/jsoncpp/jsoncpp/0001-json_writer-fix-inverted-sense-in-isAnyCharRequiredQ.patch
@@ -0,0 +1,52 @@
1From 2d5a94aeeab01f0448b5a0bb8d4a9a23a5b790d5 Mon Sep 17 00:00:00 2001
2From: Andrew Childs <lorne@cons.org.nz>
3Date: Sat, 28 Dec 2019 16:04:24 +0900
4Subject: [PATCH] json_writer: fix inverted sense in isAnyCharRequiredQuoting
5 (#1120)
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10This bug is only affects platforms where `char` is unsigned.
11
12When char is a signed type, values >= 0x80 are also considered < 0,
13and hence require escaping due to the < ' ' condition.
14
15When char is an unsigned type, values >= 0x80 match none of the
16conditions and are considered safe to emit without escaping.
17
18This shows up as a test failure:
19
20* Detail of EscapeSequenceTest/writeEscapeSequence test failure:
21/build/source/src/test_lib_json/main.cpp(3370): expected == result
22 Expected: '["\"","\\","\b","\f","\n","\r","\t","\u0278","\ud852\udf62"]
23 '
24 Actual : '["\"","\\","\b","\f","\n","\r","\t","ɸ","𤭢"]
25 '
26Upstream-Status: Backport [https://github.com/open-source-parsers/jsoncpp/commit/f11611c8785082ead760494cba06196f14a06dcb]
27
28Signed-off-by: Viktor Rosendahl <Viktor.Rosendahl@bmw.de>
29
30---
31 src/lib_json/json_writer.cpp | 5 +++--
32 1 file changed, 3 insertions(+), 2 deletions(-)
33
34diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp
35index 519ce23..b68a638 100644
36--- a/src/lib_json/json_writer.cpp
37+++ b/src/lib_json/json_writer.cpp
38@@ -178,8 +178,9 @@ static bool isAnyCharRequiredQuoting(char const* s, size_t n) {
39
40 char const* const end = s + n;
41 for (char const* cur = s; cur < end; ++cur) {
42- if (*cur == '\\' || *cur == '\"' || *cur < ' ' ||
43- static_cast<unsigned char>(*cur) < 0x80)
44+ if (*cur == '\\' || *cur == '\"' ||
45+ static_cast<unsigned char>(*cur) < ' ' ||
46+ static_cast<unsigned char>(*cur) >= 0x80)
47 return true;
48 }
49 return false;
50--
512.17.1
52
diff --git a/meta-oe/recipes-devtools/jsoncpp/jsoncpp_1.9.2.bb b/meta-oe/recipes-devtools/jsoncpp/jsoncpp_1.9.2.bb
index 629881f0cf..ae4b4c9840 100644
--- a/meta-oe/recipes-devtools/jsoncpp/jsoncpp_1.9.2.bb
+++ b/meta-oe/recipes-devtools/jsoncpp/jsoncpp_1.9.2.bb
@@ -14,7 +14,10 @@ LICENSE = "MIT"
14LIC_FILES_CHKSUM = "file://LICENSE;md5=fa2a23dd1dc6c139f35105379d76df2b" 14LIC_FILES_CHKSUM = "file://LICENSE;md5=fa2a23dd1dc6c139f35105379d76df2b"
15 15
16SRCREV = "d2e6a971f4544c55b8e3b25cf96db266971b778f" 16SRCREV = "d2e6a971f4544c55b8e3b25cf96db266971b778f"
17SRC_URI = "git://github.com/open-source-parsers/jsoncpp;branch=master;protocol=https" 17SRC_URI = "\
18 git://github.com/open-source-parsers/jsoncpp;branch=master;protocol=https \
19 file://0001-json_writer-fix-inverted-sense-in-isAnyCharRequiredQ.patch \
20 "
18 21
19S = "${WORKDIR}/git" 22S = "${WORKDIR}/git"
20 23