diff --git a/.gitignore b/.gitignore index 8b27383..68abc3f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/yajl-2.1.0.tar.gz +SOURCES/2.1.0.tar.gz diff --git a/.yajl.metadata b/.yajl.metadata index f1d4fee..5d76834 100644 --- a/.yajl.metadata +++ b/.yajl.metadata @@ -1 +1 @@ -29ce2b9695ae93e1b0b349a22cea8067f25a9025 SOURCES/yajl-2.1.0.tar.gz +29ce2b9695ae93e1b0b349a22cea8067f25a9025 SOURCES/2.1.0.tar.gz diff --git a/SOURCES/yajl-2.1.0-CVE-2022-24795.patch b/SOURCES/yajl-2.1.0-CVE-2022-24795.patch new file mode 100644 index 0000000..d27a339 --- /dev/null +++ b/SOURCES/yajl-2.1.0-CVE-2022-24795.patch @@ -0,0 +1,38 @@ +From d3a528c788ba9e531fab91db41d3a833c54da325 Mon Sep 17 00:00:00 2001 +From: Jacek Tomasiak +Date: Thu, 12 May 2022 13:02:47 +0200 +Subject: [PATCH] Fix CVE-2022-24795 (from brianmario/yajl-ruby) + +The buffer reallocation could cause heap corruption because of `need` +overflow for large inputs. In addition, there's a possible infinite loop +in case `need` reaches zero. + +The fix is to `abort()` if the loop ends with lower value of `need` than +when it started. +--- + src/yajl_buf.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +Index: yajl-2.1.0/src/yajl_buf.c +=================================================================== +diff -up yajl-2.1.0/src/yajl_buf.c.CVE-2022-24795 yajl-2.1.0/src/yajl_buf.c +--- yajl-2.1.0/src/yajl_buf.c.CVE-2022-24795 2024-01-05 14:37:48.291676702 +0100 ++++ yajl-2.1.0/src/yajl_buf.c 2024-01-05 14:38:48.088674110 +0100 +@@ -45,7 +45,16 @@ int yajl_buf_ensure_available(yajl_buf b + + need = buf->len; + +- while (want >= (need - buf->used)) need <<= 1; ++ while (need > 0 && want >= (need - buf->used)) { ++ /* this eventually "overflows" to zero */ ++ need <<= 1; ++ } ++ ++ /* overflow */ ++ if (need < buf->len) { ++ abort(); ++ } ++ + if (need < buf->used) { + return -1; + } diff --git a/SPECS/yajl.spec b/SPECS/yajl.spec index 685faf2..ca03756 100644 --- a/SPECS/yajl.spec +++ b/SPECS/yajl.spec @@ -3,7 +3,7 @@ Name: yajl Version: 2.1.0 -Release: 22%{?dist} +Release: 25%{?dist} Summary: Yet Another JSON Library (YAJL) License: ISC @@ -18,7 +18,7 @@ URL: http://lloyd.github.com/yajl/ # # https://github.com/lloyd/yajl/releases/tag/2.1.0 # -Source0: %{name}-%{version}.tar.gz +Source0: https://github.com/lloyd/yajl/archive/refs/tags/%{version}.tar.gz Patch1: %{name}-%{version}-pkgconfig-location.patch Patch2: %{name}-%{version}-pkgconfig-includedir.patch Patch3: %{name}-%{version}-test-location.patch @@ -26,8 +26,10 @@ Patch4: %{name}-%{version}-dynlink-binaries.patch Patch5: https://github.com/containers/yajl/commit/49923ccb2143e36850bcdeb781e2bcdf5ce22f15.patch Patch6: https://github.com/openEuler-BaseService/yajl/commit/3d65cb0c6db4d433e5e42ee7d91d8a04e21337cf.patch Patch7: https://github.com/openEuler-BaseService/yajl/commit/23a122eddaa28165a6c219000adcc31ff9a8a698.patch +Patch8: yajl-2.1.0-CVE-2022-24795.patch -BuildRequires: gcc +BuildRequires: git-core +BuildRequires: gcc BuildRequires: cmake %package devel @@ -48,14 +50,7 @@ This sub-package provides the libraries and includes necessary for developing against the YAJL library %prep -%setup -q -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 +%autosetup -Sgit %build # NB, we are not using upstream's 'configure'/'make' @@ -100,6 +95,18 @@ cd test %changelog +* Thu Feb 13 2025 Jindrich Novy - 2.1.0-25 +- Add missing BuildRequires +- Related: RHEL-60277 + +* Tue Feb 11 2025 Jindrich Novy - 2.1.0-24 +- spec file fixes +- Related: RHEL-60277 + +* Fri Jan 05 2024 Jindrich Novy - 2.1.0-23 +- fix CVE-2022-24795 +- Related: Jira:RHEL-2112 + * Wed Jul 12 2023 Jindrich Novy - 2.1.0-22 - fix CVE-2023-33460 - Resolves: #2221253