sync:avoid isprint, because it is locale specific
Signed-off-by: zhangzhangxin <zhangxin1@xfusion.com>
This commit is contained in:
parent
9d51aaeaf3
commit
e5d3782487
40
0002-sync-avoid-isprint-because-it-is-locale-specific.patch
Normal file
40
0002-sync-avoid-isprint-because-it-is-locale-specific.patch
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
From 08fec11ca29e0bce7d8cece6d2ab62d0604b2c9a Mon Sep 17 00:00:00 2001
|
||||||
|
From: zhangzhangxin <zhangxin1@xfusion.com>
|
||||||
|
Date: Fri, 28 Apr 2023 11:54:36 +0800
|
||||||
|
Subject: [PATCH] sync:avoid isprint, because it is locale specific
|
||||||
|
|
||||||
|
Signed-off-by: zhangzhangxin <zhangxin1@xfusion.com>
|
||||||
|
---
|
||||||
|
src/lib_json/json_writer.cpp | 6 +++---
|
||||||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp
|
||||||
|
index 03a777f..8bf02db 100644
|
||||||
|
--- a/src/lib_json/json_writer.cpp
|
||||||
|
+++ b/src/lib_json/json_writer.cpp
|
||||||
|
@@ -175,11 +175,11 @@ String valueToString(double value, unsigned int precision,
|
||||||
|
|
||||||
|
String valueToString(bool value) { return value ? "true" : "false"; }
|
||||||
|
|
||||||
|
-static bool isAnyCharRequiredQuoting(char const* s, size_t n) {
|
||||||
|
+static bool doesAnyCharRequireEscaping(char const* s, size_t n) {
|
||||||
|
assert(s || !n);
|
||||||
|
|
||||||
|
return std::any_of(s, s + n, [](unsigned char c) {
|
||||||
|
- return c == '\\' || c == '"' || !std::isprint(c);
|
||||||
|
+ return c == '\\' || c == '"' || c < 0x20 || c > 0x7F;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -275,7 +275,7 @@ static String valueToQuotedStringN(const char* value, unsigned length,
|
||||||
|
if (value == nullptr)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
- if (!isAnyCharRequiredQuoting(value, length))
|
||||||
|
+ if (!doesAnyCharRequireEscaping(value, length))
|
||||||
|
return String("\"") + value + "\"";
|
||||||
|
// We have to walk value and escape any special characters.
|
||||||
|
// Appending to String is not efficient, but this should be rare.
|
||||||
|
--
|
||||||
|
2.40.0.windows.1
|
||||||
|
|
||||||
@ -1,12 +1,13 @@
|
|||||||
Name: jsoncpp
|
Name: jsoncpp
|
||||||
Version: 1.9.3
|
Version: 1.9.3
|
||||||
Release: 3
|
Release: 4
|
||||||
Summary: JSON C++ library
|
Summary: JSON C++ library
|
||||||
License: Public Domain or MIT
|
License: Public Domain or MIT
|
||||||
URL: https://github.com/open-source-parsers/jsoncpp
|
URL: https://github.com/open-source-parsers/jsoncpp
|
||||||
Source0: https://github.com/open-source-parsers/jsoncpp/archive/%{version}/%{name}-%{version}.tar.gz
|
Source0: https://github.com/open-source-parsers/jsoncpp/archive/%{version}/%{name}-%{version}.tar.gz
|
||||||
BuildRequires: gcc-c++ cmake >= 3.1 python3-devel
|
BuildRequires: gcc-c++ cmake >= 3.1 python3-devel
|
||||||
Patch0: 0001-sync-Issue-1182-Fix-fuzzing-bug.patch
|
Patch0: 0001-sync-Issue-1182-Fix-fuzzing-bug.patch
|
||||||
|
Patch1: 0002-sync-avoid-isprint-because-it-is-locale-specific.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
JsonCpp is a C++ library that allows manipulating JSON values,
|
JsonCpp is a C++ library that allows manipulating JSON values,
|
||||||
@ -88,6 +89,9 @@ hardlink -cfv %{buildroot}%{_docdir}/%{name}
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Apr 28 2023 zhangxin <zhangxin1@xfusion.com> - 1.9.3-4
|
||||||
|
- avoid isprint, because it is locale specific
|
||||||
|
|
||||||
* Fri Apr 28 2023 zhangxin <zhangxin1@xfusion.com> - 1.9.3-3
|
* Fri Apr 28 2023 zhangxin <zhangxin1@xfusion.com> - 1.9.3-3
|
||||||
- Issue 1182: Fix fuzzing bug
|
- Issue 1182: Fix fuzzing bug
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user