commit:     e33445233f097eadbbb1acf0861e9a41593bc593
Author:     coyote <coyote <AT> bks <DOT> tv>
AuthorDate: Thu Nov 23 01:52:52 2017 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Thu Nov 23 22:30:48 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e3344523

app-antivirus/clamav: fix compatibility with >=zlib-1.2.9

Include patch from  Marc Deslauriers <marc.deslauriers <AT> canonical.com> to
fix compatibility with zlib newer 1.2.9 and enable test in ebuild (now
it work correctly).

(commit message cleaned up by Robin H. Johnson <robbat2 <AT> gentoo.org>)

Bug: https://bugs.launchpad.net/ubuntu/+source/clamav/+bug/1692073
Closes: https://bugs.gentoo.org/638544
(cherry picked from commit 535d9b43c3472916bfb977921f0a10f2cc02dc4b)
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 app-antivirus/clamav/Manifest                      |  2 +-
 app-antivirus/clamav/clamav-0.99.2-r1.ebuild       |  6 ++-
 .../clamav/files/clamav-0.99.2-bytecode_api.patch  | 50 ++++++++++++++++++++++
 3 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/app-antivirus/clamav/Manifest b/app-antivirus/clamav/Manifest
index 18a55f717c3..7c1733ae48b 100644
--- a/app-antivirus/clamav/Manifest
+++ b/app-antivirus/clamav/Manifest
@@ -1,4 +1,4 @@
 DIST clamav-0.98.7.tar.gz 15118851 SHA256 
282417b707740de13cd8f18d4cbca9ddd181cf96b444db2cad98913a5153e272 SHA512 
acf01961472c13ccb219420cc3fa3c3e6f8a733edef371dbc04ce5867900aa1535e956ec8ad50d31c8f872a0a1d79fcccac944cd86e29ecdfa4af18f7fd5afb9
 WHIRLPOOL 
c9f2e6f52f07f68bdcccf55ca1aab0bf3deaa6963279459d64ecca076a9ed0ef53c25996b2b673e9746833822df24689a9fab0654064c5ee6ed372a86966fbb6
 DIST clamav-0.99.1.tar.gz 15990867 SHA256 
e144689122d3f91293808c82cbb06b7d3ac9eca7ae29564c5d148ffe7b25d58a SHA512 
9beb5c0ebff2aef741bb27811c1f10a7cd5da354ff67272ee8994d87c95e272a5983105af0fe1a734e1fa99f112dc4dddd9d82074a0df6715814817f85a45f4f
 WHIRLPOOL 
e2afd7b7d377c1a1af802e780839bb21bcd318035ac858b6cb11545db3673d3f74ba3159b837238982248720379f98ab51e279a8636bbea89331136891e88e5d
-DIST clamav-0.99.2.tar.gz 16067497 SHA256 
167bd6a13e05ece326b968fdb539b05c2ffcfef6018a274a10aeda85c2c0027a SHA512 
7744ba8a344b163cf98e9737cddfd25d2120b34ee9c4518380e028c9ec3cd50127b198b0dfa9fde30f5ce9aab0c0e6384712fbc11287e77d16ce052fd7b6ac44
 WHIRLPOOL 
371dc56c3ffa0ff40381d451687a9331a0587943a048604c6667e1018fbfe5559b023654d29f47505bd69a1a44f88adfb5b93b7c55c8cbc6f0bbfcbf836bf631
+DIST clamav-0.99.2.tar.gz 16067497 BLAKE2B 
4155e3125ccc45cc6828033f207b6b8d3514253dfb8156428ad4096c0901d5a8500f9dd253b8f40afdc49a6039b647627868f75d51829ab7bd247ada5f3b8383
 SHA512 
7744ba8a344b163cf98e9737cddfd25d2120b34ee9c4518380e028c9ec3cd50127b198b0dfa9fde30f5ce9aab0c0e6384712fbc11287e77d16ce052fd7b6ac44
 DIST clamav-0.99.tar.gz 15968038 SHA256 
d2792c8cfadd685fffc40b2199679628815df031fd3149ccf961649fc8787ea9 SHA512 
328e66fa412ba61f5e44c839b254c7a84d2ce7821fda6cf29e4ee9532c06e45bdec62f202ca561223e984fff170bfd8280e5cc8e306c09a3017b17e7db3bbf56
 WHIRLPOOL 
696b425c0d3a6639d627e6dba000a57c4e532232f9f42a564a992c0b459d8041a1947b09548d99b621a5685c78d91045adf4b61731242f55eda2b8d5150fc8b8

diff --git a/app-antivirus/clamav/clamav-0.99.2-r1.ebuild 
b/app-antivirus/clamav/clamav-0.99.2-r1.ebuild
index 579249e1388..a44017407cf 100644
--- a/app-antivirus/clamav/clamav-0.99.2-r1.ebuild
+++ b/app-antivirus/clamav/clamav-0.99.2-r1.ebuild
@@ -7,7 +7,6 @@ inherit autotools eutils flag-o-matic user systemd
 
 DESCRIPTION="Clam Anti-Virus Scanner"
 HOMEPAGE="http://www.clamav.net/";
-# no longer on sf.net from 0.99.2 onwards
 SRC_URI="https://www.clamav.net/downloads/production/${P}.tar.gz";
 
 LICENSE="GPL-2"
@@ -40,6 +39,7 @@ PATCHES=(
        "${FILESDIR}"/${P}-gcc-6.patch
        "${FILESDIR}"/${P}-tinfo.patch
        "${FILESDIR}"/${PN}-0.99-zlib.patch
+       "${FILESDIR}"/${P}-bytecode_api.patch
 )
 
 pkg_setup() {
@@ -142,6 +142,10 @@ src_install() {
        prune_libtool_files --all
 }
 
+src_test() {
+       emake quick-check
+}
+
 pkg_postinst() {
        if use milter ; then
                elog "For simple instructions how to setup the clamav-milter 
read the"

diff --git a/app-antivirus/clamav/files/clamav-0.99.2-bytecode_api.patch 
b/app-antivirus/clamav/files/clamav-0.99.2-bytecode_api.patch
new file mode 100644
index 00000000000..d6cd5264ed7
--- /dev/null
+++ b/app-antivirus/clamav/files/clamav-0.99.2-bytecode_api.patch
@@ -0,0 +1,50 @@
+Description: fix compatibility with zlib 1.2.9 and newer
+Author: Marc Deslauriers <marc.deslauri...@canonical.com>
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/clamav/+bug/1692073
+
+--- a/libclamav/bytecode_api.c 2017-08-08 15:20:06.651685637 -0400
++++ b/libclamav/bytecode_api.c 2017-08-15 15:45:14.645714766 -0400
+@@ -811,8 +811,20 @@ int32_t cli_bcapi_inflate_init(struct cl
+         cli_dbgmsg("bytecode api: inflate_init: invalid buffers!\n");
+         return -1;
+     }
+-    memset(&stream, 0, sizeof(stream));
+-    ret = inflateInit2(&stream, windowBits);
++
++    b = cli_realloc(ctx->inflates, sizeof(*ctx->inflates)*n);
++    if (!b) {
++        return -1;
++    }
++    ctx->inflates = b;
++    ctx->ninflates = n;
++    b = &b[n-1];
++
++    b->from = from;
++    b->to = to;
++    b->needSync = 0;
++    memset(&b->stream, 0, sizeof(stream));
++    ret = inflateInit2(&b->stream, windowBits);
+     switch (ret) {
+         case Z_MEM_ERROR:
+             cli_dbgmsg("bytecode api: inflateInit2: out of memory!\n");
+@@ -829,20 +841,6 @@ int32_t cli_bcapi_inflate_init(struct cl
+             cli_dbgmsg("bytecode api: inflateInit2: unknown error %d\n", ret);
+             return -1;
+     }
+-
+-    b = cli_realloc(ctx->inflates, sizeof(*ctx->inflates)*n);
+-    if (!b) {
+-        inflateEnd(&stream);
+-        return -1;
+-    }
+-    ctx->inflates = b;
+-    ctx->ninflates = n;
+-    b = &b[n-1];
+-
+-    b->from = from;
+-    b->to = to;
+-    b->needSync = 0;
+-    memcpy(&b->stream, &stream, sizeof(stream));
+     return n-1;
+ }
+ 

Reply via email to