commit:     0bac9cd799d02dba8269e8699233d93d0b4b699a
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 19 23:02:08 2023 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Sat Aug 19 23:06:41 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0bac9cd7

app-forensics/zzuf: add 0.15_p20220529

As far as upstream is concerned this snapshot is identical to _p20190208
apart from some typos in the documentation having been fixed. On the
Gentoo side, however, this ebuild adds support for building with
-Werror=implicit-function-declaration along with removing the previously
hard-coded '-g -O2' from compiler flags.

Closes: https://bugs.gentoo.org/871558
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 app-forensics/zzuf/Manifest                        |  1 +
 .../zzuf-0.15_autoconf-hardcoded-cflags.patch      | 11 ++++++
 .../zzuf/files/zzuf-0.15_implicit_functions.patch  | 32 +++++++++++++++
 .../zzuf/files/zzuf-0.15_use-after-free.patch      | 20 ++++++++++
 app-forensics/zzuf/zzuf-0.15_p20220529.ebuild      | 45 ++++++++++++++++++++++
 5 files changed, 109 insertions(+)

diff --git a/app-forensics/zzuf/Manifest b/app-forensics/zzuf/Manifest
index 54710407b8a1..134d8d844623 100644
--- a/app-forensics/zzuf/Manifest
+++ b/app-forensics/zzuf/Manifest
@@ -1 +1,2 @@
 DIST zzuf-0.15_p20190208.tar.gz 140812 BLAKE2B 
908661fdb51a5b2d5b188ac7df2731c5f069db8489651145f6d4a5cb0f02dc99fa10c3771a034645043f547ef92dfe9e3cfa3f1442dbad690d88ef620f2cfdd8
 SHA512 
e4d6b4356385642323520c1f1d476b572465881df539d0c6e7110ca7974da81b4b744896df7deac8b462707ca9e0db578ca0c118d6ba2da4bc78ffe31328f711
+DIST zzuf-0.15_p20220529.tar.gz 140825 BLAKE2B 
a36207082210e062575bed45eac4a83923cbe5f0e60c0b093053ac96abef085a0e6506d5b7db6b11ed7f0979462fbb92f69767ac548de1a1f96a12d84aac8584
 SHA512 
50e3c8908f579a70d41d7887ff7d87634f3b856ae82bb7ec6dccacccf363a6494d825e0b6debf683ed29408dcd5dc83dbb39c2d2000be0d79aee5f819d69185a

diff --git a/app-forensics/zzuf/files/zzuf-0.15_autoconf-hardcoded-cflags.patch 
b/app-forensics/zzuf/files/zzuf-0.15_autoconf-hardcoded-cflags.patch
new file mode 100644
index 000000000000..f8cbfa5c7642
--- /dev/null
+++ b/app-forensics/zzuf/files/zzuf-0.15_autoconf-hardcoded-cflags.patch
@@ -0,0 +1,11 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -39,8 +39,6 @@
+ AC_MSG_RESULT($SONAME)
+ AC_DEFINE_UNQUOTED(SONAME, "$SONAME", [Define to the libzzuf full name])
+ 
+-# Optimizations
+-AC_TRY_CFLAGS(-g -O2, CFLAGS="${CFLAGS} -g -O2")
+ # Code qui fait des warnings == code de porc == deux baffes dans ta gueule
+ AC_TRY_CFLAGS(-Wall, CFLAGS="${CFLAGS} -Wall")
+ AC_TRY_CFLAGS(-W, CFLAGS="${CFLAGS} -W")

diff --git a/app-forensics/zzuf/files/zzuf-0.15_implicit_functions.patch 
b/app-forensics/zzuf/files/zzuf-0.15_implicit_functions.patch
new file mode 100644
index 000000000000..aa73a6f03d2b
--- /dev/null
+++ b/app-forensics/zzuf/files/zzuf-0.15_implicit_functions.patch
@@ -0,0 +1,32 @@
+--- a/src/libc_fcns.h
++++ b/src/libc_fcns.h
+@@ -0,0 +1,8 @@
++#ifndef _ZZUF_LIBC_FCNS_H
++#define _ZZUF_LIBC_FCNS_H
++
++/* Prototypes for internal libc functions zzuf hooks into */
++extern int __fseeko64(FILE *fp, off64_t offset, int whence);
++extern int _IO_getc(FILE *__fp);
++
++#endif
+--- a/src/libzzuf/lib-stream.c
++++ b/src/libzzuf/lib-stream.c
+@@ -57,6 +57,7 @@
+ #include "debug.h"
+ #include "fuzz.h"
+ #include "fd.h"
++#include "libc_fcns.h"
+ 
+ #if defined HAVE_FPOS64_T
+ #   define FPOS64_T fpos64_t
+--- a/src/zzat.c
++++ b/src/zzat.c
+@@ -51,6 +51,8 @@
+ 
+ #include "util/getopt.h"
+ 
++#include "libc_fcns.h"
++
+ static int run(char const *sequence, char const *file);
+ static void output(char const *buf, size_t len);
+ 

diff --git a/app-forensics/zzuf/files/zzuf-0.15_use-after-free.patch 
b/app-forensics/zzuf/files/zzuf-0.15_use-after-free.patch
new file mode 100644
index 000000000000..3de95d91608c
--- /dev/null
+++ b/app-forensics/zzuf/files/zzuf-0.15_use-after-free.patch
@@ -0,0 +1,20 @@
+--- a/test/zzone.c
++++ b/test/zzone.c
+@@ -64,14 +64,14 @@
+             last++;
+     }
+ 
+-    free(buf);
+-    free(tmp);
+-
+     size_t total = 0;
+     for (size_t i = last; i < size; i++)
+         total += countzeroes(buf[i]);
+     printf("%li\n", (long)total);
+ 
++    free(buf);
++    free(tmp);
++
+     return EXIT_SUCCESS;
+ }
+ 

diff --git a/app-forensics/zzuf/zzuf-0.15_p20220529.ebuild 
b/app-forensics/zzuf/zzuf-0.15_p20220529.ebuild
new file mode 100644
index 000000000000..8b4f9015fa3c
--- /dev/null
+++ b/app-forensics/zzuf/zzuf-0.15_p20220529.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools multilib-minimal
+
+EGIT_COMMIT="a7111e51eac3086264fcca0c7026de22b5ab55c7"
+DESCRIPTION="Transparent application input fuzzer"
+HOMEPAGE="http://caca.zoy.org/wiki/zzuf";
+SRC_URI="https://github.com/samhocevar/${PN}/archive/${EGIT_COMMIT}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="WTFPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~sparc ~x86"
+
+# Uses dlopen hack to hijack many libc functions.
+# Fails 2 tests with sandbox enabled: check-zzuf-A-autoinc check-utils
+RESTRICT="test"
+
+DOCS=( AUTHORS COPYING TODO )
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.15_autoconf-hardcoded-cflags.patch
+       "${FILESDIR}"/${PN}-0.15_autoconf-musl.patch
+       "${FILESDIR}"/${PN}-0.15_implicit_functions.patch
+       "${FILESDIR}"/${PN}-0.15_use-after-free.patch
+)
+
+S="${WORKDIR}"/${PN}-${EGIT_COMMIT}
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+multilib_src_configure() {
+       ECONF_SOURCE="${S}" econf
+}
+
+multilib_src_install_all() {
+       default
+
+       find "${ED}" -name '*.la' -delete || die
+}

Reply via email to