* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libconfig/, dev-libs/libconfig/files/
@ 2015-10-31 7:23 Jeroen Roovers
0 siblings, 0 replies; 3+ messages in thread
From: Jeroen Roovers @ 2015-10-31 7:23 UTC (permalink / raw
To: gentoo-commits
commit: efb3b24589873239f2ad0345395ac575f4aa8fc5
Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 31 07:23:42 2015 +0000
Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
CommitDate: Sat Oct 31 07:23:42 2015 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=efb3b245
dev-libs/libconfig: Old.
Package-Manager: portage-2.2.23
dev-libs/libconfig/Manifest | 1 -
.../libconfig-1.4.9-out-of-source-build.patch | 16 -------
dev-libs/libconfig/libconfig-1.4.9-r1.ebuild | 55 ----------------------
3 files changed, 72 deletions(-)
diff --git a/dev-libs/libconfig/Manifest b/dev-libs/libconfig/Manifest
index dc45cf7..e753ae7 100644
--- a/dev-libs/libconfig/Manifest
+++ b/dev-libs/libconfig/Manifest
@@ -1,2 +1 @@
-DIST libconfig-1.4.9.tar.gz 688158 SHA256 09c8979252e60193e2969e9b0e1cd597f7820087867989b2f0939ad164473041 SHA512 49a4318c1b8a5f15dc0cefaf25c481f95008e413696420d5e8cacb7a6ce7e600b84c4b7e7365373cee62e392e14556ff31d65c1e084a9b7ab2153a55cbf787a7 WHIRLPOOL 3d64dfb7cfd21c769738791236d6f6f4b01d296d060c21767f441f644b0d0bba62b5782bd7129dcc2657377200e59a345a5f197a67b5579e2193447fdefc1d25
DIST libconfig-1.5.tar.gz 644432 SHA256 e31daa390d8e4461c8830512fe2e13ba1a3d6a02a2305a02429eec61e68703f6 SHA512 16bead52ee8c880b25fd1ee6fa83c115dc51830f2f7954389bd8b72cc0e6fc05fc63fe415bd929851894a9f3a1127d51cfc4223149514246e9566305556b7bcd WHIRLPOOL ef3718b1ec4485202d1fd03db035419b6c0179e4c4eb47e74ff93b467677c4f53cf9d70d5eb7aa6230dab7a4115e5fae0fc4ed191f1bfc6d0c3c252ee5d90944
diff --git a/dev-libs/libconfig/files/libconfig-1.4.9-out-of-source-build.patch b/dev-libs/libconfig/files/libconfig-1.4.9-out-of-source-build.patch
deleted file mode 100644
index fe7c2cc..0000000
--- a/dev-libs/libconfig/files/libconfig-1.4.9-out-of-source-build.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/libconfig-1.4.9/tests/Makefile.am
-+++ b/libconfig-1.4.9/tests/Makefile.am
-@@ -3,10 +3,10 @@
-
- libconfig_tests_SOURCES = tests.c
-
--libconfig_tests_CPPFLAGS = -I../tinytest -I../lib
-+libconfig_tests_CPPFLAGS = -I$(top_srcdir)/tinytest -I$(top_srcdir)/lib
-
--libconfig_tests_LDADD = -L../tinytest -ltinytest \
-- -L../lib/.libs -lconfig
-+libconfig_tests_LDADD = -L$(top_builddir)/tinytest -ltinytest \
-+ -L$(top_builddir)/lib/.libs -lconfig
-
-
- EXTRA_DIST = \
diff --git a/dev-libs/libconfig/libconfig-1.4.9-r1.ebuild b/dev-libs/libconfig/libconfig-1.4.9-r1.ebuild
deleted file mode 100644
index 45b0e65..0000000
--- a/dev-libs/libconfig/libconfig-1.4.9-r1.ebuild
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-AUTOTOOLS_AUTORECONF="1"
-inherit eutils autotools-multilib
-
-DESCRIPTION="Libconfig is a simple library for manipulating structured configuration files"
-HOMEPAGE="http://www.hyperrealm.com/libconfig/libconfig.html"
-SRC_URI="http://www.hyperrealm.com/${PN}/${P}.tar.gz"
-
-LICENSE="LGPL-2.1"
-SLOT="0"
-KEYWORDS="amd64 ~arm ~mips ppc ppc64 sparc x86 ~x86-linux"
-IUSE="+cxx examples static-libs"
-
-DEPEND="
- sys-devel/libtool
- sys-devel/bison"
-
-PATCHES=( "${FILESDIR}/${P}-out-of-source-build.patch" )
-
-src_prepare() {
- sed -i configure.ac -e 's|AM_CONFIG_HEADER|AC_CONFIG_HEADERS|g' || die
- autotools-multilib_src_prepare
-}
-
-multilib_src_configure() {
- local myeconfargs=(
- $(use_enable cxx)
- --disable-examples
- )
- autotools-utils_src_configure
-}
-
-multilib_src_test() {
- # It responds to check but that does not work as intended
- emake test
-}
-
-multilib_src_install_all() {
- einstalldocs
- prune_libtool_files
-
- if use examples; then
- find examples/ -name "Makefile.*" -delete || die
- local dir
- for dir in examples/c examples/c++; do
- insinto /usr/share/doc/${PF}/${dir}
- doins ${dir}/*
- done
- fi
-}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libconfig/, dev-libs/libconfig/files/
@ 2025-05-22 15:59 Sam James
0 siblings, 0 replies; 3+ messages in thread
From: Sam James @ 2025-05-22 15:59 UTC (permalink / raw
To: gentoo-commits
commit: 4b3d656a450d0e7b6aa402eb784ae63440c0ced0
Author: Nicolas PARLANT <nicolas.parlant <AT> parhuet <DOT> fr>
AuthorDate: Thu May 22 08:36:20 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu May 22 15:58:49 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b3d656a
dev-libs/libconfig: add 1.8.0
this release builds with gcc-15 / llvm-20
add dot-a eclass for static-libs
two patches from upstream for 32bits tests and invalid mem write
Signed-off-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/42200
Closes: https://github.com/gentoo/gentoo/pull/42200
Signed-off-by: Sam James <sam <AT> gentoo.org>
dev-libs/libconfig/Manifest | 1 +
.../libconfig-1.8.0-fix_format_bin_32bit.patch | 32 +++++++
.../files/libconfig-1.8.0-fix_inv_mem_w.patch | 103 +++++++++++++++++++++
dev-libs/libconfig/libconfig-1.8.0.ebuild | 74 +++++++++++++++
4 files changed, 210 insertions(+)
diff --git a/dev-libs/libconfig/Manifest b/dev-libs/libconfig/Manifest
index fc104704e778..e9c21d97b356 100644
--- a/dev-libs/libconfig/Manifest
+++ b/dev-libs/libconfig/Manifest
@@ -1 +1,2 @@
DIST libconfig-1.7.3.tar.gz 3026416 BLAKE2B 94301be4d6e472fc9daeac7a04074855737ddda94bb5748cd0087fafe192cf674ea1c020808ebf855372188b6b27a57ed185323fa26988bb1fccde0566617cba SHA512 3749bf9eb29bab0f6b14f4fc759f0c419ed27a843842aaabed1ec1fbe0faa8c93322ff875ca1291d69cb28a39ece86d512aec42c2140d566c38c56dc616734f4
+DIST libconfig-1.8.0.tar.gz 1722355 BLAKE2B 3879fa62277332f9df07c3776d11e6ec6c7518fe83c83a6b50b15683a34d9d57f54bb550f911076654b0f62c40fa650167d8a233e01f05be0c5b5dcc9fc8749b SHA512 7899d3898e1741d90cf2381561b172ec6ba2bcc47d1b3e6058bcef74d73634d9be33eb8f99a58c7af15ac99e56800510edf3c412d9c1f136e6a3ab744455b992
diff --git a/dev-libs/libconfig/files/libconfig-1.8.0-fix_format_bin_32bit.patch b/dev-libs/libconfig/files/libconfig-1.8.0-fix_format_bin_32bit.patch
new file mode 100644
index 000000000000..0af33d7fb324
--- /dev/null
+++ b/dev-libs/libconfig/files/libconfig-1.8.0-fix_format_bin_32bit.patch
@@ -0,0 +1,32 @@
+https://github.com/hyperrealm/libconfig/pull/260
+From b90c45a18110fcca415d00a98ff79c908c42544b Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyich@gmail.com>
+Date: Thu, 1 May 2025 20:58:26 +0100
+Subject: [PATCH] libconfig_format_bin: fix on 32-bit systems
+
+Before the change conversion of bin produced wrong
+leading zeros and failed test son `i686-linux` as:
+
+ [TEST] BinaryAndHex
+ files "temp.cfg" and "./testdata/binhex.cfg" differ starting at line 5, char 12
+ tests.c:55: failed assert: ("temp.cfg") ["temp.cfg"] ==txtfile (output_file) ["./testdata/binhex.cfg"]
+ [FAIL] BinaryAndHex
+
+Closes: https://github.com/hyperrealm/libconfig/issues/259
+---
+ lib/util.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/util.c b/lib/util.c
+index 5455cac..cf73766 100644
+--- a/lib/util.c
++++ b/lib/util.c
+@@ -286,7 +286,7 @@ void libconfig_format_double(double val, int precision, int sci_ok, char *buf,
+ /* ------------------------------------------------------------------------- */
+
+ #ifdef __GNUC__
+-#define clzl(x) __builtin_clzl(x)
++#define clzl(x) __builtin_clzll(x)
+ #else
+ static int clzl(int64_t val)
+ {
diff --git a/dev-libs/libconfig/files/libconfig-1.8.0-fix_inv_mem_w.patch b/dev-libs/libconfig/files/libconfig-1.8.0-fix_inv_mem_w.patch
new file mode 100644
index 000000000000..aee117ca9e3b
--- /dev/null
+++ b/dev-libs/libconfig/files/libconfig-1.8.0-fix_inv_mem_w.patch
@@ -0,0 +1,103 @@
+https://github.com/hyperrealm/libconfig/pull/261
+From f55523ab4722b216349d909bf770f7a84b4f4c67 Mon Sep 17 00:00:00 2001
+From: Shubham Tiwari <58452132+Shubham7-1@users.noreply.github.com>
+Date: Sun, 4 May 2025 17:39:52 +0530
+Subject: [PATCH] Fix invalid memory write
+
+---
+ fuzz/fuzz_config_read.c | 60 ++++++++++++++++++-----------------------
+ 1 file changed, 26 insertions(+), 34 deletions(-)
+
+diff --git a/fuzz/fuzz_config_read.c b/fuzz/fuzz_config_read.c
+index 38138dd..02adb0b 100644
+--- a/fuzz/fuzz_config_read.c
++++ b/fuzz/fuzz_config_read.c
+@@ -93,49 +93,36 @@ size_t LLVMFuzzerCustomMutator(uint8_t *data, size_t size,
+ srand(seed);
+ config_init(&cfg);
+
+- fuzz_data_t *fuzz_data = (fuzz_data_t *) data;
+-
+- // Ensure MIN_BUFF_SIZE * 2 <= size <= MAX_BUFF_SIZE
+- if (remaining_size < MIN_BUFF_SIZE)
+- {
+- return 2 * MIN_BUFF_SIZE;
+- }
+- if (remaining_size > MAX_BUFF_SIZE)
+- {
+- return MAX_BUFF_SIZE;
++ if (size < MIN_BUFF_SIZE || max_size < MIN_BUFF_SIZE || max_size > MAX_BUFF_SIZE) {
++ return MIN_BUFF_SIZE;
+ }
+
+- remaining_size -= MIN_BUFF_SIZE;
++ fuzz_data_t *fuzz_data = (fuzz_data_t *) data;
++ remaining_size -= sizeof(fuzz_data_t);
+
+- fuzz_data->lookup_type = rand() % (CONFIG_TYPE_LIST + 1);
++ // Limit sizes to avoid overflow
++ size_t max_content = min_size(remaining_size, MAX_CONFIG_SIZE - 1);
++ fuzz_data->content_size = rand() % max_content;
+
+- // Ensure the content and path sizes are within bounds
+- if (fuzz_data->content_size + fuzz_data->path_size > remaining_size)
+- {
+- fuzz_data->content_size = rand() % remaining_size;
+- fuzz_data->path_size = remaining_size - fuzz_data->content_size;
++ size_t max_path = min_size(remaining_size - fuzz_data->content_size, MAX_PATH_SIZE - 1);
++ fuzz_data->path_size = rand() % max_path;
++
++ if (fuzz_data->content_size + fuzz_data->path_size + sizeof(fuzz_data_t) >= max_size) {
++ fuzz_data->content_size = max_content / 2;
++ fuzz_data->path_size = max_path / 2;
+ }
+
+- // Extract and mutate the config
+ fuzz_data_content(fuzz_data, &config_data);
+- fuzz_data->content_size = LLVMFuzzerMutate(config_data, fuzz_data->content_size, remaining_size);
+- config_data[fuzz_data->content_size] = '\0'; // Null-terminate the config
++ fuzz_data_path(fuzz_data, &path_data);
+
+- if (fuzz_data->content_size > remaining_size) {
+- return 0;
+- }
++ // Mutate content and path safely
++ fuzz_data->content_size = LLVMFuzzerMutate(config_data, fuzz_data->content_size, max_content);
++ config_data[fuzz_data->content_size < max_content ? fuzz_data->content_size : max_content - 1] = '\0';
+
+- remaining_size -= fuzz_data->content_size;
++ fuzz_data->path_size = LLVMFuzzerMutate(path_data, fuzz_data->path_size, max_path);
++ path_data[fuzz_data->path_size < max_path ? fuzz_data->path_size : max_path - 1] = '\0';
+
+- // Extract and mutate the path
+- fuzz_data->path_size = min_size(fuzz_data->path_size, remaining_size);
+- fuzz_data_path(fuzz_data, &path_data);
+- if (remaining_size > 0) {
+- fuzz_data->path_size = LLVMFuzzerMutate(path_data, fuzz_data->path_size, remaining_size);
+- }
+- path_data[fuzz_data->path_size] = '\0'; // Null-terminate the path
+-
+- return min_size(MIN_BUFF_SIZE + fuzz_data->content_size + fuzz_data->path_size, max_size);
++ return sizeof(fuzz_data_t) + fuzz_data->content_size + fuzz_data->path_size + 2;
+ }
+
+ int LLVMFuzzerTestOneInput(const uint8_t *data, const size_t size)
+@@ -169,6 +156,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, const size_t size)
+
+ config_init(&cfg);
+
++ if (fuzz_data->content_size > MAX_CONFIG_SIZE ||
++ fuzz_data->path_size > MAX_PATH_SIZE ||
++ sizeof(fuzz_data_t) + fuzz_data->content_size + fuzz_data->path_size > size) {
++ goto end;
++ }
+ fuzz_data_content(fuzz_data, &config_ptr);
+ fuzz_data_path(fuzz_data, &path_ptr);
+ const char *config_data = (const char *) config_ptr;
+@@ -243,4 +235,4 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, const size_t size)
+ end:
+ config_destroy(&cfg);
+ return rc;
+-}
+\ No newline at end of file
++}
diff --git a/dev-libs/libconfig/libconfig-1.8.0.ebuild b/dev-libs/libconfig/libconfig-1.8.0.ebuild
new file mode 100644
index 000000000000..69be7e860802
--- /dev/null
+++ b/dev-libs/libconfig/libconfig-1.8.0.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+MY_PV=1.8 # Release "1.8.0" tagged as "1.8"
+
+inherit autotools dot-a multilib-minimal
+
+DESCRIPTION="Libconfig is a simple library for manipulating structured configuration files"
+HOMEPAGE="
+ https://www.hyperrealm.com/libconfig/libconfig.html
+ https://github.com/hyperrealm/libconfig
+"
+SRC_URI="https://github.com/hyperrealm/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+LICENSE="LGPL-2.1"
+SLOT="0/11"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x86-linux"
+IUSE="+cxx static-libs test"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+ sys-apps/texinfo
+ app-alternatives/yacc
+ dev-build/libtool
+"
+
+PATCHES=(
+ # Fix tests on 32bits. Merged upstream
+ # https://github.com/hyperrealm/libconfig/pull/260
+ "${FILESDIR}"/${P}-fix_format_bin_32bit.patch
+ # Fix mem corruption. Merged upstream
+ # https://github.com/hyperrealm/libconfig/pull/261
+ "${FILESDIR}"/${P}-fix_inv_mem_w.patch
+)
+
+src_prepare() {
+ default
+
+ sed -i \
+ -e '/sleep 3/d' \
+ configure.ac || die
+
+ eautoreconf
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ use static-libs && lto-guarantee-fat
+
+ local myeconfargs=(
+ $(use_enable cxx)
+ $(use_enable static-libs static)
+ $(use_enable test tests)
+ --disable-examples
+ )
+
+ econf "${myeconfargs[@]}"
+}
+
+multilib_src_test() {
+ # It responds to check but that does not work as intended
+ emake test
+}
+
+multilib_src_install() {
+ default
+
+ find "${ED}" -name '*.la' -delete || die
+
+ strip-lto-bytecode
+}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libconfig/, dev-libs/libconfig/files/
@ 2025-06-01 3:23 Sam James
0 siblings, 0 replies; 3+ messages in thread
From: Sam James @ 2025-06-01 3:23 UTC (permalink / raw
To: gentoo-commits
commit: e45491eff4ab9e829186e4a860bd00db6b2ab856
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 1 03:23:08 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jun 1 03:23:08 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e45491ef
dev-libs/libconfig: drop 1.8.0
Bad release, broke ABI and needed some backports for serious issues. Use
1.8.1. Drop so we don't accidentally stabilise this.
Signed-off-by: Sam James <sam <AT> gentoo.org>
dev-libs/libconfig/Manifest | 1 -
.../libconfig-1.8.0-fix_format_bin_32bit.patch | 32 -------
.../files/libconfig-1.8.0-fix_inv_mem_w.patch | 103 ---------------------
dev-libs/libconfig/libconfig-1.8.0.ebuild | 75 ---------------
4 files changed, 211 deletions(-)
diff --git a/dev-libs/libconfig/Manifest b/dev-libs/libconfig/Manifest
index 8cae7f1ac343..77e91d3019ae 100644
--- a/dev-libs/libconfig/Manifest
+++ b/dev-libs/libconfig/Manifest
@@ -1,3 +1,2 @@
DIST libconfig-1.7.3.tar.gz 3026416 BLAKE2B 94301be4d6e472fc9daeac7a04074855737ddda94bb5748cd0087fafe192cf674ea1c020808ebf855372188b6b27a57ed185323fa26988bb1fccde0566617cba SHA512 3749bf9eb29bab0f6b14f4fc759f0c419ed27a843842aaabed1ec1fbe0faa8c93322ff875ca1291d69cb28a39ece86d512aec42c2140d566c38c56dc616734f4
-DIST libconfig-1.8.0.tar.gz 1722355 BLAKE2B 3879fa62277332f9df07c3776d11e6ec6c7518fe83c83a6b50b15683a34d9d57f54bb550f911076654b0f62c40fa650167d8a233e01f05be0c5b5dcc9fc8749b SHA512 7899d3898e1741d90cf2381561b172ec6ba2bcc47d1b3e6058bcef74d73634d9be33eb8f99a58c7af15ac99e56800510edf3c412d9c1f136e6a3ab744455b992
DIST libconfig-1.8.1.tar.gz 1726710 BLAKE2B 96e6da09e8efdd6091edfe58cbc860296e6c484257ea95df95eea3c103fc03a46159136483d35ac4bf25ab6284d8284a1bd988d8499eb057d6226ac4ae7e950a SHA512 1d9d7b21baf73259c09b503ca02942bdf847741378f8c3d7e138c9b4979c5304aae510595958fe1842b726778cedf2aaeb1844f8b209a61ccb24debea592bd0c
diff --git a/dev-libs/libconfig/files/libconfig-1.8.0-fix_format_bin_32bit.patch b/dev-libs/libconfig/files/libconfig-1.8.0-fix_format_bin_32bit.patch
deleted file mode 100644
index 0af33d7fb324..000000000000
--- a/dev-libs/libconfig/files/libconfig-1.8.0-fix_format_bin_32bit.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-https://github.com/hyperrealm/libconfig/pull/260
-From b90c45a18110fcca415d00a98ff79c908c42544b Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyich@gmail.com>
-Date: Thu, 1 May 2025 20:58:26 +0100
-Subject: [PATCH] libconfig_format_bin: fix on 32-bit systems
-
-Before the change conversion of bin produced wrong
-leading zeros and failed test son `i686-linux` as:
-
- [TEST] BinaryAndHex
- files "temp.cfg" and "./testdata/binhex.cfg" differ starting at line 5, char 12
- tests.c:55: failed assert: ("temp.cfg") ["temp.cfg"] ==txtfile (output_file) ["./testdata/binhex.cfg"]
- [FAIL] BinaryAndHex
-
-Closes: https://github.com/hyperrealm/libconfig/issues/259
----
- lib/util.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/util.c b/lib/util.c
-index 5455cac..cf73766 100644
---- a/lib/util.c
-+++ b/lib/util.c
-@@ -286,7 +286,7 @@ void libconfig_format_double(double val, int precision, int sci_ok, char *buf,
- /* ------------------------------------------------------------------------- */
-
- #ifdef __GNUC__
--#define clzl(x) __builtin_clzl(x)
-+#define clzl(x) __builtin_clzll(x)
- #else
- static int clzl(int64_t val)
- {
diff --git a/dev-libs/libconfig/files/libconfig-1.8.0-fix_inv_mem_w.patch b/dev-libs/libconfig/files/libconfig-1.8.0-fix_inv_mem_w.patch
deleted file mode 100644
index aee117ca9e3b..000000000000
--- a/dev-libs/libconfig/files/libconfig-1.8.0-fix_inv_mem_w.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-https://github.com/hyperrealm/libconfig/pull/261
-From f55523ab4722b216349d909bf770f7a84b4f4c67 Mon Sep 17 00:00:00 2001
-From: Shubham Tiwari <58452132+Shubham7-1@users.noreply.github.com>
-Date: Sun, 4 May 2025 17:39:52 +0530
-Subject: [PATCH] Fix invalid memory write
-
----
- fuzz/fuzz_config_read.c | 60 ++++++++++++++++++-----------------------
- 1 file changed, 26 insertions(+), 34 deletions(-)
-
-diff --git a/fuzz/fuzz_config_read.c b/fuzz/fuzz_config_read.c
-index 38138dd..02adb0b 100644
---- a/fuzz/fuzz_config_read.c
-+++ b/fuzz/fuzz_config_read.c
-@@ -93,49 +93,36 @@ size_t LLVMFuzzerCustomMutator(uint8_t *data, size_t size,
- srand(seed);
- config_init(&cfg);
-
-- fuzz_data_t *fuzz_data = (fuzz_data_t *) data;
--
-- // Ensure MIN_BUFF_SIZE * 2 <= size <= MAX_BUFF_SIZE
-- if (remaining_size < MIN_BUFF_SIZE)
-- {
-- return 2 * MIN_BUFF_SIZE;
-- }
-- if (remaining_size > MAX_BUFF_SIZE)
-- {
-- return MAX_BUFF_SIZE;
-+ if (size < MIN_BUFF_SIZE || max_size < MIN_BUFF_SIZE || max_size > MAX_BUFF_SIZE) {
-+ return MIN_BUFF_SIZE;
- }
-
-- remaining_size -= MIN_BUFF_SIZE;
-+ fuzz_data_t *fuzz_data = (fuzz_data_t *) data;
-+ remaining_size -= sizeof(fuzz_data_t);
-
-- fuzz_data->lookup_type = rand() % (CONFIG_TYPE_LIST + 1);
-+ // Limit sizes to avoid overflow
-+ size_t max_content = min_size(remaining_size, MAX_CONFIG_SIZE - 1);
-+ fuzz_data->content_size = rand() % max_content;
-
-- // Ensure the content and path sizes are within bounds
-- if (fuzz_data->content_size + fuzz_data->path_size > remaining_size)
-- {
-- fuzz_data->content_size = rand() % remaining_size;
-- fuzz_data->path_size = remaining_size - fuzz_data->content_size;
-+ size_t max_path = min_size(remaining_size - fuzz_data->content_size, MAX_PATH_SIZE - 1);
-+ fuzz_data->path_size = rand() % max_path;
-+
-+ if (fuzz_data->content_size + fuzz_data->path_size + sizeof(fuzz_data_t) >= max_size) {
-+ fuzz_data->content_size = max_content / 2;
-+ fuzz_data->path_size = max_path / 2;
- }
-
-- // Extract and mutate the config
- fuzz_data_content(fuzz_data, &config_data);
-- fuzz_data->content_size = LLVMFuzzerMutate(config_data, fuzz_data->content_size, remaining_size);
-- config_data[fuzz_data->content_size] = '\0'; // Null-terminate the config
-+ fuzz_data_path(fuzz_data, &path_data);
-
-- if (fuzz_data->content_size > remaining_size) {
-- return 0;
-- }
-+ // Mutate content and path safely
-+ fuzz_data->content_size = LLVMFuzzerMutate(config_data, fuzz_data->content_size, max_content);
-+ config_data[fuzz_data->content_size < max_content ? fuzz_data->content_size : max_content - 1] = '\0';
-
-- remaining_size -= fuzz_data->content_size;
-+ fuzz_data->path_size = LLVMFuzzerMutate(path_data, fuzz_data->path_size, max_path);
-+ path_data[fuzz_data->path_size < max_path ? fuzz_data->path_size : max_path - 1] = '\0';
-
-- // Extract and mutate the path
-- fuzz_data->path_size = min_size(fuzz_data->path_size, remaining_size);
-- fuzz_data_path(fuzz_data, &path_data);
-- if (remaining_size > 0) {
-- fuzz_data->path_size = LLVMFuzzerMutate(path_data, fuzz_data->path_size, remaining_size);
-- }
-- path_data[fuzz_data->path_size] = '\0'; // Null-terminate the path
--
-- return min_size(MIN_BUFF_SIZE + fuzz_data->content_size + fuzz_data->path_size, max_size);
-+ return sizeof(fuzz_data_t) + fuzz_data->content_size + fuzz_data->path_size + 2;
- }
-
- int LLVMFuzzerTestOneInput(const uint8_t *data, const size_t size)
-@@ -169,6 +156,11 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, const size_t size)
-
- config_init(&cfg);
-
-+ if (fuzz_data->content_size > MAX_CONFIG_SIZE ||
-+ fuzz_data->path_size > MAX_PATH_SIZE ||
-+ sizeof(fuzz_data_t) + fuzz_data->content_size + fuzz_data->path_size > size) {
-+ goto end;
-+ }
- fuzz_data_content(fuzz_data, &config_ptr);
- fuzz_data_path(fuzz_data, &path_ptr);
- const char *config_data = (const char *) config_ptr;
-@@ -243,4 +235,4 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, const size_t size)
- end:
- config_destroy(&cfg);
- return rc;
--}
-\ No newline at end of file
-+}
diff --git a/dev-libs/libconfig/libconfig-1.8.0.ebuild b/dev-libs/libconfig/libconfig-1.8.0.ebuild
deleted file mode 100644
index f6bd444b8d1b..000000000000
--- a/dev-libs/libconfig/libconfig-1.8.0.ebuild
+++ /dev/null
@@ -1,75 +0,0 @@
-# Copyright 1999-2025 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-MY_PV=1.8 # Release "1.8.0" tagged as "1.8"
-
-inherit autotools dot-a multilib-minimal
-
-DESCRIPTION="Libconfig is a simple library for manipulating structured configuration files"
-HOMEPAGE="
- https://www.hyperrealm.com/libconfig/libconfig.html
- https://github.com/hyperrealm/libconfig
-"
-SRC_URI="https://github.com/hyperrealm/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
-S="${WORKDIR}/${PN}-${MY_PV}"
-
-LICENSE="LGPL-2.1"
-# XXX: Drop .1 w/ >1.8.0, as that should change SONAME again
-SLOT="0/11.1"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x86-linux"
-IUSE="+cxx static-libs test"
-RESTRICT="!test? ( test )"
-
-DEPEND="
- sys-apps/texinfo
- app-alternatives/yacc
- dev-build/libtool
-"
-
-PATCHES=(
- # Fix tests on 32bits. Merged upstream
- # https://github.com/hyperrealm/libconfig/pull/260
- "${FILESDIR}"/${P}-fix_format_bin_32bit.patch
- # Fix mem corruption. Merged upstream
- # https://github.com/hyperrealm/libconfig/pull/261
- "${FILESDIR}"/${P}-fix_inv_mem_w.patch
-)
-
-src_prepare() {
- default
-
- sed -i \
- -e '/sleep 3/d' \
- configure.ac || die
-
- eautoreconf
- multilib_copy_sources
-}
-
-multilib_src_configure() {
- use static-libs && lto-guarantee-fat
-
- local myeconfargs=(
- $(use_enable cxx)
- $(use_enable static-libs static)
- $(use_enable test tests)
- --disable-examples
- )
-
- econf "${myeconfargs[@]}"
-}
-
-multilib_src_test() {
- # It responds to check but that does not work as intended
- emake test
-}
-
-multilib_src_install() {
- default
-
- find "${ED}" -name '*.la' -delete || die
-
- strip-lto-bytecode
-}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-01 3:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-01 3:23 [gentoo-commits] repo/gentoo:master commit in: dev-libs/libconfig/, dev-libs/libconfig/files/ Sam James
-- strict thread matches above, loose matches on Subject: below --
2025-05-22 15:59 Sam James
2015-10-31 7:23 Jeroen Roovers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox