security/clamav: Compile-time test fails during portinstall

Apply patch from upstream.

PR:	221513
Submitted by:	jny@jny.dk, fsbruva@yahoo.com
This commit is contained in:
Larry Rosenman 2017-09-22 16:11:54 +00:00
parent f695bb6480
commit 1faef9ef46
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=450394
3 changed files with 52 additions and 17 deletions

View file

@ -12,15 +12,6 @@
fi
if test -n "$vuln"; then
@@ -20758,7 +20758,7 @@ $as_echo "#define C_BSD 1" >>confdefs.h
;;
freebsd*)
if test "$have_pthreads" = "yes"; then
- THREAD_LIBS="-lthr"
+ THREAD_LIBS="%%PTHREAD_LIBS%%"
TH_SAFE="-thread-safe"
fi
@@ -20934,7 +20934,7 @@ esac
if test "$have_milter" = "yes"; then

View file

@ -0,0 +1,44 @@
--- libclamav/bytecode_api.c.orig 2016-04-22 15:02:19 UTC
+++ libclamav/bytecode_api.c
@@ -811,8 +811,19 @@ int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx,
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");
@@ -830,19 +841,6 @@ int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx,
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;
}

View file

@ -1,6 +1,6 @@
--- libclamav/c++/llvm/include/llvm/Support/CFG.h.orig
--- libclamav/c++/llvm/include/llvm/Support/CFG.h.orig 2016-04-22 15:02:19 UTC
+++ libclamav/c++/llvm/include/llvm/Support/CFG.h
@@ -27,8 +27,9 @@
@@ -27,8 +27,9 @@ namespace llvm {
template <class Ptr, class USE_iterator> // Predecessor Iterator
class PredIterator : public std::iterator<std::forward_iterator_tag,
@ -12,15 +12,15 @@
typedef PredIterator<Ptr, USE_iterator> Self;
USE_iterator It;
@@ -40,6 +41,7 @@
@@ -40,6 +41,7 @@ class PredIterator : public std::iterator<std::forward
public:
typedef typename super::pointer pointer;
+ typedef typename super::reference reference;
PredIterator() {}
explicit inline PredIterator(Ptr *bb) : It(bb->use_begin()) {
@@ -50,7 +52,7 @@
advancePastNonTerminators();
@@ -49,7 +51,7 @@ class PredIterator : public std::iterator<std::forward
inline bool operator==(const Self& x) const { return It == x.It; }
inline bool operator!=(const Self& x) const { return !operator==(x); }
@ -29,7 +29,7 @@
assert(!It.atEnd() && "pred_iterator out of range!");
return cast<TerminatorInst>(*It)->getParent();
}
@@ -100,10 +102,11 @@
@@ -87,10 +89,11 @@ inline const_pred_iterator pred_end(const BasicBlock *
template <class Term_, class BB_> // Successor Iterator
class SuccIterator : public std::iterator<std::bidirectional_iterator_tag,
@ -43,7 +43,7 @@
typedef SuccIterator<Term_, BB_> Self;
inline bool index_is_valid(int idx) {
@@ -112,6 +115,7 @@
@@ -99,6 +102,7 @@ class SuccIterator : public std::iterator<std::bidirec
public:
typedef typename super::pointer pointer;
@ -51,7 +51,7 @@
// TODO: This can be random access iterator, only operator[] missing.
explicit inline SuccIterator(Term_ T) : Term(T), idx(0) {// begin iterator
@@ -142,7 +146,7 @@
@@ -122,7 +126,7 @@ class SuccIterator : public std::iterator<std::bidirec
inline bool operator==(const Self& x) const { return idx == x.idx; }
inline bool operator!=(const Self& x) const { return !operator==(x); }