* [dunfell][PATCH v3] jsoncpp: Fix broken handling of escape characters
@ 2020-11-10 18:44 Viktor Rosendahl
2022-05-30 10:27 ` Ranjitsinh Rathod
0 siblings, 1 reply; 3+ messages in thread
From: Viktor Rosendahl @ 2020-11-10 18:44 UTC (permalink / raw)
To: openembedded-devel; +Cc: Viktor Rosendahl, Viktor Rosendahl
Applying this backported patch from upstream fixes the following
test failure:
* Detail of EscapeSequenceTest/writeEscapeSequence test failure:
/home/viktor/jsoncpp/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 failure only happens on architectures that use unsigned char as
default type for char. It doesn't happen on x86 because it uses signed
char by default. However, the failure can be emulated on x86 by adding
the following line to the beginning of CMakeLists.txt:
add_compile_options(-funsigned-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"
This patch is not needed in master or gatesgarth branches, because they
use version 1.9.3 of jsoncpp, which doesn't have the bug.
Signed-off-by: Viktor Rosendahl <Viktor.Rosendahl@bmw.de>
---
...inverted-sense-in-isAnyCharRequiredQ.patch | 49 +++++++++++++++++++
.../recipes-devtools/jsoncpp/jsoncpp_1.9.2.bb | 5 +-
2 files changed, 53 insertions(+), 1 deletion(-)
create mode 100644 meta-oe/recipes-devtools/jsoncpp/jsoncpp/0001-json_writer-fix-inverted-sense-in-isAnyCharRequiredQ.patch
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 000000000..ff03e0565
--- /dev/null
+++ b/meta-oe/recipes-devtools/jsoncpp/jsoncpp/0001-json_writer-fix-inverted-sense-in-isAnyCharRequiredQ.patch
@@ -0,0 +1,49 @@
+From 2d5a94aeeab01f0448b5a0bb8d4a9a23a5b790d5 Mon Sep 17 00:00:00 2001
+From: Andrew Childs <lorne@cons.org.nz>
+Date: Sat, 28 Dec 2019 16:04:24 +0900
+Subject: [PATCH] json_writer: fix inverted sense in isAnyCharRequiredQuoting
+ (#1120)
+
+This bug is only affects platforms where `char` is unsigned.
+
+When char is a signed type, values >= 0x80 are also considered < 0,
+and hence require escaping due to the < ' ' condition.
+
+When char is an unsigned type, values >= 0x80 match none of the
+conditions and are considered safe to emit without escaping.
+
+This shows up as a test failure:
+
+* Detail of EscapeSequenceTest/writeEscapeSequence test failure:
+/build/source/src/test_lib_json/main.cpp(3370): expected == result
+ Expected: '["\"","\\","\b","\f","\n","\r","\t","\u0278","\ud852\udf62"]
+ '
+ Actual : '["\"","\\","\b","\f","\n","\r","\t","",""]
+ '
+Upstream-Status: Backport [https://github.com/open-source-parsers/jsoncpp/commit/f11611c8785082ead760494cba06196f14a06dcb]
+
+Signed-off-by: Viktor Rosendahl <Viktor.Rosendahl@bmw.de>
+
+---
+ src/lib_json/json_writer.cpp | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp
+index 519ce23..b68a638 100644
+--- a/src/lib_json/json_writer.cpp
++++ b/src/lib_json/json_writer.cpp
+@@ -178,8 +178,9 @@ static bool isAnyCharRequiredQuoting(char const* s, size_t n) {
+
+ char const* const end = s + n;
+ for (char const* cur = s; cur < end; ++cur) {
+- if (*cur == '\\' || *cur == '\"' || *cur < ' ' ||
+- static_cast<unsigned char>(*cur) < 0x80)
++ if (*cur == '\\' || *cur == '\"' ||
++ static_cast<unsigned char>(*cur) < ' ' ||
++ static_cast<unsigned char>(*cur) >= 0x80)
+ return true;
+ }
+ return false;
+--
+2.17.1
+
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 8a5db3da3..6482a93a7 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"
LIC_FILES_CHKSUM = "file://LICENSE;md5=fa2a23dd1dc6c139f35105379d76df2b"
SRCREV = "d2e6a971f4544c55b8e3b25cf96db266971b778f"
-SRC_URI = "git://github.com/open-source-parsers/jsoncpp"
+SRC_URI = "\
+ git://github.com/open-source-parsers/jsoncpp \
+ file://0001-json_writer-fix-inverted-sense-in-isAnyCharRequiredQ.patch \
+ "
S = "${WORKDIR}/git"
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [dunfell][PATCH v3] jsoncpp: Fix broken handling of escape characters
2020-11-10 18:44 [dunfell][PATCH v3] jsoncpp: Fix broken handling of escape characters Viktor Rosendahl
@ 2022-05-30 10:27 ` Ranjitsinh Rathod
[not found] ` <cf76c492-465f-4f30-6f97-d02f3c22fa7f@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Ranjitsinh Rathod @ 2022-05-30 10:27 UTC (permalink / raw)
To: openembedded-devel
[-- Attachment #1: Type: text/plain, Size: 76 bytes --]
Hi Armin,
Can you please take this patch?
Thanks,
Ranjitsinh Rathod
[-- Attachment #2: Type: text/html, Size: 96 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [oe] [dunfell][PATCH v3] jsoncpp: Fix broken handling of escape characters
[not found] ` <cf76c492-465f-4f30-6f97-d02f3c22fa7f@gmail.com>
@ 2023-04-27 16:30 ` Ranjitsinh Rathod
0 siblings, 0 replies; 3+ messages in thread
From: Ranjitsinh Rathod @ 2023-04-27 16:30 UTC (permalink / raw)
To: Ranjitsinh Rathod, openembedded-devel@lists.openembedded.org,
akuster808@gmail.com
[-- Attachment #1.1: Type: text/plain, Size: 1924 bytes --]
Hi Armin,
I have sent a patch again at https://lists.openembedded.org/g/openembedded-devel/message/102212
Can you please take it now?
Thanks,
Best Regards,
Ranjitsinh Rathod
Technical Leader | | KPIT Technologies Ltd.
Cellphone: +91-84606 92403
__________________________________________
KPIT<http://www.kpit.com/> | Follow us on LinkedIn<http://www.kpit.com/linkedin>
[cid:8aeca2ab-d6cf-414e-b0fd-6f5e4dce6814]<https://www.kpit.com/TheNewBrand>
________________________________
From: openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org> on behalf of Armin Kuster via lists.openembedded.org <akuster808=gmail.com@lists.openembedded.org>
Sent: Monday, May 30, 2022 7:52 PM
To: Ranjitsinh Rathod <ranjitsinhrathod1991@gmail.com>; openembedded-devel@lists.openembedded.org <openembedded-devel@lists.openembedded.org>
Subject: Re: [oe] [dunfell][PATCH v3] jsoncpp: Fix broken handling of escape characters
Caution: This email originated from outside of the KPIT. Do not click links or open attachments unless you recognize the sender and know the content is safe.
On 5/30/22 03:27, Ranjitsinh Rathod wrote:
> Hi Armin,
>
> Can you please take this patch?
I am at a lose.. I don't see this patch in my inbox nor in the lore
archives. Do you mind re-sending it?
-armin
>
> Thanks,
> Ranjitsinh Rathod
>
>
>
This message contains information that may be privileged or confidential and is the property of the KPIT Technologies Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Technologies Ltd. does not accept any liability for virus infected mails.
[-- Attachment #1.2: Type: text/html, Size: 6915 bytes --]
[-- Attachment #2: Outlook-uifxphpw.png --]
[-- Type: image/png, Size: 22485 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-27 16:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-10 18:44 [dunfell][PATCH v3] jsoncpp: Fix broken handling of escape characters Viktor Rosendahl
2022-05-30 10:27 ` Ranjitsinh Rathod
[not found] ` <cf76c492-465f-4f30-6f97-d02f3c22fa7f@gmail.com>
2023-04-27 16:30 ` [oe] " Ranjitsinh Rathod
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.