Compare commits
No commits in common. 'cs10' and 'c9' have entirely different histories.
@ -1,30 +0,0 @@
|
|||||||
From 0eaa8db35c9e580f27ba0c90d11b173cb1d96687 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
|
||||||
Date: Mon, 10 Jul 2023 13:43:25 +0100
|
|
||||||
Subject: [PATCH 2/8] pkg-config include dir should not have the 'yajl' suffix
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Apps use '#include <yajl/yajl.h>' for includes historically.
|
|
||||||
|
|
||||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
||||||
---
|
|
||||||
src/yajl.pc.cmake | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/yajl.pc.cmake b/src/yajl.pc.cmake
|
|
||||||
index 6eaca14..485ded9 100644
|
|
||||||
--- a/src/yajl.pc.cmake
|
|
||||||
+++ b/src/yajl.pc.cmake
|
|
||||||
@@ -1,6 +1,6 @@
|
|
||||||
prefix=${CMAKE_INSTALL_PREFIX}
|
|
||||||
libdir=${dollar}{prefix}/lib${LIB_SUFFIX}
|
|
||||||
-includedir=${dollar}{prefix}/include/yajl
|
|
||||||
+includedir=${dollar}{prefix}/include
|
|
||||||
|
|
||||||
Name: Yet Another JSON Library
|
|
||||||
Description: A Portable JSON parsing and serialization library in ANSI C
|
|
||||||
--
|
|
||||||
2.41.0
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
From c98c00d6957601b95f3982f3d9460868469a299e Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
|
||||||
Date: Mon, 10 Jul 2023 13:45:36 +0100
|
|
||||||
Subject: [PATCH 4/8] drop bogus '_s' suffix from yajl dynamic library
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
||||||
---
|
|
||||||
reformatter/CMakeLists.txt | 2 +-
|
|
||||||
verify/CMakeLists.txt | 2 +-
|
|
||||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/reformatter/CMakeLists.txt b/reformatter/CMakeLists.txt
|
|
||||||
index 52a9bee..4b7b3fa 100644
|
|
||||||
--- a/reformatter/CMakeLists.txt
|
|
||||||
+++ b/reformatter/CMakeLists.txt
|
|
||||||
@@ -26,7 +26,7 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(json_reformat ${SRCS})
|
|
||||||
|
|
||||||
-TARGET_LINK_LIBRARIES(json_reformat yajl_s)
|
|
||||||
+TARGET_LINK_LIBRARIES(json_reformat yajl)
|
|
||||||
|
|
||||||
# In some environments, we must explicitly link libm (like qnx,
|
|
||||||
# thanks @shahbag)
|
|
||||||
diff --git a/verify/CMakeLists.txt b/verify/CMakeLists.txt
|
|
||||||
index 967fca1..2bceb26 100644
|
|
||||||
--- a/verify/CMakeLists.txt
|
|
||||||
+++ b/verify/CMakeLists.txt
|
|
||||||
@@ -26,7 +26,7 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(json_verify ${SRCS})
|
|
||||||
|
|
||||||
-TARGET_LINK_LIBRARIES(json_verify yajl_s)
|
|
||||||
+TARGET_LINK_LIBRARIES(json_verify yajl)
|
|
||||||
|
|
||||||
# copy in the binary
|
|
||||||
GET_TARGET_PROPERTY(binPath json_verify LOCATION)
|
|
||||||
--
|
|
||||||
2.41.0
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
From 0b5e73c4321de0ba1d495fdc0967054b2a77931c Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
|
||||||
Date: Mon, 10 Jul 2023 13:36:10 +0100
|
|
||||||
Subject: [PATCH 5/8] Fix for CVE-2017-16516
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
Description: Fix for CVE-2017-16516
|
|
||||||
Potential buffer overread: A JSON file can cause denial of service.
|
|
||||||
Origin: https://github.com/brianmario/yajl-ruby/commit/a8ca8f476655adaa187eedc60bdc770fff3c51ce
|
|
||||||
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1040036
|
|
||||||
Bug: https://github.com/lloyd/yajl/issues/248
|
|
||||||
|
|
||||||
Patch taken from Debian package source
|
|
||||||
|
|
||||||
NB, Fedora code can't trigger the reported aborts since it passes the
|
|
||||||
-DNDEBUG flag, but pulling the fix for robustness in case a future
|
|
||||||
change enables the assert()s.
|
|
||||||
|
|
||||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
||||||
---
|
|
||||||
src/yajl_encode.c | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/yajl_encode.c b/src/yajl_encode.c
|
|
||||||
index fd08258..0d97cc5 100644
|
|
||||||
--- a/src/yajl_encode.c
|
|
||||||
+++ b/src/yajl_encode.c
|
|
||||||
@@ -139,8 +139,8 @@ void yajl_string_decode(yajl_buf buf, const unsigned char * str,
|
|
||||||
end+=3;
|
|
||||||
/* check if this is a surrogate */
|
|
||||||
if ((codepoint & 0xFC00) == 0xD800) {
|
|
||||||
- end++;
|
|
||||||
- if (str[end] == '\\' && str[end + 1] == 'u') {
|
|
||||||
+ if (end + 2 < len && str[end + 1] == '\\' && str[end + 2] == 'u') {
|
|
||||||
+ end++;
|
|
||||||
unsigned int surrogate = 0;
|
|
||||||
hexToDigit(&surrogate, str + end + 2);
|
|
||||||
codepoint =
|
|
||||||
--
|
|
||||||
2.41.0
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
|||||||
From 17de4d15687aa30c49660dc4b792b1fb4d38b569 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
||||||
Date: Thu, 7 Apr 2022 17:29:54 +0200
|
|
||||||
Subject: [PATCH 6/8] Fix CVE-2022-24795
|
|
||||||
|
|
||||||
There was an integer overflow in yajl_buf_ensure_available() leading
|
|
||||||
to allocating less memory than requested. Then data were written past
|
|
||||||
the allocated heap buffer in yajl_buf_append(), the only caller of
|
|
||||||
yajl_buf_ensure_available(). Another result of the overflow was an
|
|
||||||
infinite loop without a return from yajl_buf_ensure_available().
|
|
||||||
|
|
||||||
yajl-ruby project, which bundles yajl, fixed it
|
|
||||||
<https://github.com/brianmario/yajl-ruby/pull/211> by checking for the
|
|
||||||
integer overflow, fortifying buffer allocations, and report the
|
|
||||||
failures to a caller. But then the caller yajl_buf_append() skips
|
|
||||||
a memory write if yajl_buf_ensure_available() failed leading to a data
|
|
||||||
corruption.
|
|
||||||
|
|
||||||
A yajl fork mainter recommended calling memory allocation callbacks with
|
|
||||||
the large memory request and let them to handle it. But that has the
|
|
||||||
problem that it's not possible pass the overely large size to the
|
|
||||||
callbacks.
|
|
||||||
|
|
||||||
This patch catches the integer overflow and terminates the process
|
|
||||||
with abort().
|
|
||||||
|
|
||||||
https://github.com/lloyd/yajl/issues/239
|
|
||||||
https://github.com/brianmario/yajl-ruby/security/advisories/GHSA-jj47-x69x-mxrm
|
|
||||||
(cherry picked from commit 23cea2d7677e396efed78bbf1bf153961fab6bad
|
|
||||||
in https://github.com/ppisar/yajl)
|
|
||||||
---
|
|
||||||
src/yajl_buf.c | 12 +++++++++++-
|
|
||||||
1 file changed, 11 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/yajl_buf.c b/src/yajl_buf.c
|
|
||||||
index 1aeafde..55c11ad 100644
|
|
||||||
--- a/src/yajl_buf.c
|
|
||||||
+++ b/src/yajl_buf.c
|
|
||||||
@@ -45,7 +45,17 @@ void yajl_buf_ensure_available(yajl_buf buf, size_t want)
|
|
||||||
|
|
||||||
need = buf->len;
|
|
||||||
|
|
||||||
- while (want >= (need - buf->used)) need <<= 1;
|
|
||||||
+ if (((buf->used > want) ? buf->used : want) > (size_t)(buf->used + want)) {
|
|
||||||
+ /* We cannot allocate more memory than SIZE_MAX. */
|
|
||||||
+ abort();
|
|
||||||
+ }
|
|
||||||
+ while (want >= (need - buf->used)) {
|
|
||||||
+ if (need >= (size_t)((size_t)(-1)<<1)>>1) {
|
|
||||||
+ /* need would overflow. */
|
|
||||||
+ abort();
|
|
||||||
+ }
|
|
||||||
+ need <<= 1;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (need != buf->len) {
|
|
||||||
buf->data = (unsigned char *) YA_REALLOC(buf->alloc, buf->data, need);
|
|
||||||
--
|
|
||||||
2.41.0
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
|||||||
|
From 49923ccb2143e36850bcdeb781e2bcdf5ce22f15 Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Hawthorn <john@hawthorn.email>
|
||||||
|
Date: Wed, 2 Mar 2022 14:17:59 -0800
|
||||||
|
Subject: [PATCH] Check need < buf->used
|
||||||
|
|
||||||
|
We're guaranteed a power of 2 so that this becomes 0, but we might as
|
||||||
|
well use a check for overflow that works in more cases.
|
||||||
|
|
||||||
|
Unsigned integer overflow is defined behaviour, so this should be safe.
|
||||||
|
|
||||||
|
(cherry picked from commit 36410d536b676e836637bb20574a56ebc920eb83)
|
||||||
|
---
|
||||||
|
src/yajl_buf.c | 9 +++++++--
|
||||||
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/yajl_buf.c b/src/yajl_buf.c
|
||||||
|
index 1aeafde0..8bd1bea7 100644
|
||||||
|
--- a/src/yajl_buf.c
|
||||||
|
+++ b/src/yajl_buf.c
|
||||||
|
@@ -30,7 +30,7 @@ struct yajl_buf_t {
|
||||||
|
};
|
||||||
|
|
||||||
|
static
|
||||||
|
-void yajl_buf_ensure_available(yajl_buf buf, size_t want)
|
||||||
|
+int yajl_buf_ensure_available(yajl_buf buf, size_t want)
|
||||||
|
{
|
||||||
|
size_t need;
|
||||||
|
|
||||||
|
@@ -46,11 +46,15 @@ void yajl_buf_ensure_available(yajl_buf buf, size_t want)
|
||||||
|
need = buf->len;
|
||||||
|
|
||||||
|
while (want >= (need - buf->used)) need <<= 1;
|
||||||
|
+ if (need < buf->used) {
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (need != buf->len) {
|
||||||
|
buf->data = (unsigned char *) YA_REALLOC(buf->alloc, buf->data, need);
|
||||||
|
buf->len = need;
|
||||||
|
}
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
yajl_buf yajl_buf_alloc(yajl_alloc_funcs * alloc)
|
||||||
|
@@ -70,7 +74,8 @@ void yajl_buf_free(yajl_buf buf)
|
||||||
|
|
||||||
|
void yajl_buf_append(yajl_buf buf, const void * data, size_t len)
|
||||||
|
{
|
||||||
|
- yajl_buf_ensure_available(buf, len);
|
||||||
|
+ if (yajl_buf_ensure_available(buf, len))
|
||||||
|
+ return;
|
||||||
|
if (len > 0) {
|
||||||
|
assert(data != NULL);
|
||||||
|
memcpy(buf->data + buf->used, data, len);
|
@ -0,0 +1,28 @@
|
|||||||
|
diff -rup yajl-2.1.0.orig/reformatter/CMakeLists.txt yajl-2.1.0.new/reformatter/CMakeLists.txt
|
||||||
|
--- yajl-2.1.0.orig/reformatter/CMakeLists.txt 2014-03-19 04:58:29.000000000 +0000
|
||||||
|
+++ yajl-2.1.0.new/reformatter/CMakeLists.txt 2014-04-28 11:36:11.909478329 +0100
|
||||||
|
@@ -26,7 +26,7 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(json_reformat ${SRCS})
|
||||||
|
|
||||||
|
-TARGET_LINK_LIBRARIES(json_reformat yajl_s)
|
||||||
|
+TARGET_LINK_LIBRARIES(json_reformat yajl)
|
||||||
|
|
||||||
|
# In some environments, we must explicitly link libm (like qnx,
|
||||||
|
# thanks @shahbag)
|
||||||
|
Only in yajl-2.1.0.new/reformatter: CMakeLists.txt.orig
|
||||||
|
Only in yajl-2.1.0.new/src: CMakeLists.txt~
|
||||||
|
Only in yajl-2.1.0.new/test/api: run_tests.sh~
|
||||||
|
Only in yajl-2.1.0.new/test/parsing: run_tests.sh~
|
||||||
|
diff -rup yajl-2.1.0.orig/verify/CMakeLists.txt yajl-2.1.0.new/verify/CMakeLists.txt
|
||||||
|
--- yajl-2.1.0.orig/verify/CMakeLists.txt 2014-03-19 04:58:29.000000000 +0000
|
||||||
|
+++ yajl-2.1.0.new/verify/CMakeLists.txt 2014-04-28 11:36:11.909478329 +0100
|
||||||
|
@@ -26,7 +26,7 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(json_verify ${SRCS})
|
||||||
|
|
||||||
|
-TARGET_LINK_LIBRARIES(json_verify yajl_s)
|
||||||
|
+TARGET_LINK_LIBRARIES(json_verify yajl)
|
||||||
|
|
||||||
|
# copy in the binary
|
||||||
|
GET_TARGET_PROPERTY(binPath json_verify LOCATION)
|
@ -0,0 +1,11 @@
|
|||||||
|
diff -rup yajl-2.1.0.orig/src/yajl.pc.cmake yajl-2.1.0.new/src/yajl.pc.cmake
|
||||||
|
--- yajl-2.1.0.orig/src/yajl.pc.cmake 2014-03-19 04:58:29.000000000 +0000
|
||||||
|
+++ yajl-2.1.0.new/src/yajl.pc.cmake 2014-04-28 11:12:23.505791003 +0100
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
prefix=${CMAKE_INSTALL_PREFIX}
|
||||||
|
libdir=${dollar}{prefix}/lib${LIB_SUFFIX}
|
||||||
|
-includedir=${dollar}{prefix}/include/yajl
|
||||||
|
+includedir=${dollar}{prefix}/include
|
||||||
|
|
||||||
|
Name: Yet Another JSON Library
|
||||||
|
Description: A Portable JSON parsing and serialization library in ANSI C
|
Loading…
Reference in new issue