Gentoo Archives: gentoo-commits

From: Aaron Bauman <bman@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-antivirus/clamav/files/
Date: Sun, 27 May 2018 16:11:16
Message-Id: 1527437361.b706131c0f3184e53e71a7f787ac28385d12526c.bman@gentoo
1 commit: b706131c0f3184e53e71a7f787ac28385d12526c
2 Author: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail <DOT> com>
3 AuthorDate: Sun May 27 11:57:09 2018 +0000
4 Commit: Aaron Bauman <bman <AT> gentoo <DOT> org>
5 CommitDate: Sun May 27 16:09:21 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b706131c
7
8 app-antivirus/clamav: remove unused patches
9
10 Closes: https://github.com/gentoo/gentoo/pull/8607
11
12 app-antivirus/clamav/files/clamav-0.99-zlib.patch | 22 ---
13 .../clamav/files/clamav-0.99.2-bytecode_api.patch | 50 ------
14 .../clamav/files/clamav-0.99.2-gcc-6.patch | 84 ----------
15 .../clamav-0.99.2-pcre2-compile-erroffset.patch | 12 --
16 .../clamav/files/clamav-0.99.2-tinfo.patch | 23 ---
17 ...lamav-0.99.3-VMSF_DELTA-fix-CVE-2012-6706.patch | 186 ---------------------
18 ...mav-0.99.3-fix-fd-leaks-in-cli_scanscript.patch | 132 ---------------
19 7 files changed, 509 deletions(-)
20
21 diff --git a/app-antivirus/clamav/files/clamav-0.99-zlib.patch b/app-antivirus/clamav/files/clamav-0.99-zlib.patch
22 deleted file mode 100644
23 index 8d1f4e61537..00000000000
24 --- a/app-antivirus/clamav/files/clamav-0.99-zlib.patch
25 +++ /dev/null
26 @@ -1,22 +0,0 @@
27 -commit f0bcd186190fe6e67b3f0eaaceb7a99aa6a98865
28 -Author: Steven Morgan <stevmorg@×××××.com>
29 -Date: Thu Jan 5 12:30:35 2017 -0500
30 -
31 - bb111711 - fix zlib version check - patch by Daniel J. Luke.
32 -
33 -diff --git a/m4/reorganization/libs/libz.m4 b/m4/reorganization/libs/libz.m4
34 -index b5c7414..f7b67ca 100644
35 ---- a/m4/reorganization/libs/libz.m4
36 -+++ b/m4/reorganization/libs/libz.m4
37 -@@ -29,9 +29,9 @@ then
38 - AC_MSG_ERROR([Please install zlib and zlib-devel packages])
39 - else
40 -
41 -- vuln=`grep "ZLIB_VERSION \"1.2.0" $ZLIB_HOME/include/zlib.h`
42 -+ vuln=`grep "ZLIB_VERSION \"1.2.0\"" $ZLIB_HOME/include/zlib.h`
43 - if test -z "$vuln"; then
44 -- vuln=`grep "ZLIB_VERSION \"1.2.1" $ZLIB_HOME/include/zlib.h`
45 -+ vuln=`grep "ZLIB_VERSION \"1.2.1\"" $ZLIB_HOME/include/zlib.h`
46 - fi
47 -
48 - if test -n "$vuln"; then
49
50 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
51 deleted file mode 100644
52 index d6cd5264ed7..00000000000
53 --- a/app-antivirus/clamav/files/clamav-0.99.2-bytecode_api.patch
54 +++ /dev/null
55 @@ -1,50 +0,0 @@
56 -Description: fix compatibility with zlib 1.2.9 and newer
57 -Author: Marc Deslauriers <marc.deslauriers@×××××××××.com>
58 -Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/clamav/+bug/1692073
59 -
60 ---- a/libclamav/bytecode_api.c 2017-08-08 15:20:06.651685637 -0400
61 -+++ b/libclamav/bytecode_api.c 2017-08-15 15:45:14.645714766 -0400
62 -@@ -811,8 +811,20 @@ int32_t cli_bcapi_inflate_init(struct cl
63 - cli_dbgmsg("bytecode api: inflate_init: invalid buffers!\n");
64 - return -1;
65 - }
66 -- memset(&stream, 0, sizeof(stream));
67 -- ret = inflateInit2(&stream, windowBits);
68 -+
69 -+ b = cli_realloc(ctx->inflates, sizeof(*ctx->inflates)*n);
70 -+ if (!b) {
71 -+ return -1;
72 -+ }
73 -+ ctx->inflates = b;
74 -+ ctx->ninflates = n;
75 -+ b = &b[n-1];
76 -+
77 -+ b->from = from;
78 -+ b->to = to;
79 -+ b->needSync = 0;
80 -+ memset(&b->stream, 0, sizeof(stream));
81 -+ ret = inflateInit2(&b->stream, windowBits);
82 - switch (ret) {
83 - case Z_MEM_ERROR:
84 - cli_dbgmsg("bytecode api: inflateInit2: out of memory!\n");
85 -@@ -829,20 +841,6 @@ int32_t cli_bcapi_inflate_init(struct cl
86 - cli_dbgmsg("bytecode api: inflateInit2: unknown error %d\n", ret);
87 - return -1;
88 - }
89 --
90 -- b = cli_realloc(ctx->inflates, sizeof(*ctx->inflates)*n);
91 -- if (!b) {
92 -- inflateEnd(&stream);
93 -- return -1;
94 -- }
95 -- ctx->inflates = b;
96 -- ctx->ninflates = n;
97 -- b = &b[n-1];
98 --
99 -- b->from = from;
100 -- b->to = to;
101 -- b->needSync = 0;
102 -- memcpy(&b->stream, &stream, sizeof(stream));
103 - return n-1;
104 - }
105 -
106
107 diff --git a/app-antivirus/clamav/files/clamav-0.99.2-gcc-6.patch b/app-antivirus/clamav/files/clamav-0.99.2-gcc-6.patch
108 deleted file mode 100644
109 index 2031edbd382..00000000000
110 --- a/app-antivirus/clamav/files/clamav-0.99.2-gcc-6.patch
111 +++ /dev/null
112 @@ -1,84 +0,0 @@
113 -diff --git a/libclamav/c++/llvm/include/llvm/ADT/StringMap.h b/libclamav/c++/llvm/include/llvm/ADT/StringMap.h
114 -index 59ff6aa..1325394 100644
115 ---- a/libclamav/c++/llvm/include/llvm/ADT/StringMap.h
116 -+++ b/libclamav/c++/llvm/include/llvm/ADT/StringMap.h
117 -@@ -169,3 +169,3 @@ public:
118 - KeyLength+1;
119 -- unsigned Alignment = alignof<StringMapEntry>();
120 -+ unsigned Alignment = alignOf<StringMapEntry>();
121 -
122 -diff --git a/libclamav/c++/llvm/include/llvm/CodeGen/SlotIndexes.h b/libclamav/c++/llvm/include/llvm/CodeGen/SlotIndexes.h
123 -index 88044c7..86b0f40 100644
124 ---- a/libclamav/c++/llvm/include/llvm/CodeGen/SlotIndexes.h
125 -+++ b/libclamav/c++/llvm/include/llvm/CodeGen/SlotIndexes.h
126 -@@ -417,3 +417,3 @@ namespace llvm {
127 - ileAllocator.Allocate(sizeof(IndexListEntry),
128 -- alignof<IndexListEntry>()));
129 -+ alignOf<IndexListEntry>()));
130 -
131 -diff --git a/libclamav/c++/llvm/include/llvm/Support/AlignOf.h b/libclamav/c++/llvm/include/llvm/Support/AlignOf.h
132 -index 6a7a1a6..979e597 100644
133 ---- a/libclamav/c++/llvm/include/llvm/Support/AlignOf.h
134 -+++ b/libclamav/c++/llvm/include/llvm/Support/AlignOf.h
135 -@@ -51,8 +51,8 @@ struct AlignOf {
136 -
137 --/// alignof - A templated function that returns the mininum alignment of
138 -+/// alignOf - A templated function that returns the mininum alignment of
139 - /// of a type. This provides no extra functionality beyond the AlignOf
140 - /// class besides some cosmetic cleanliness. Example usage:
141 --/// alignof<int>() returns the alignment of an int.
142 -+/// alignOf<int>() returns the alignment of an int.
143 - template <typename T>
144 --static inline unsigned alignof() { return AlignOf<T>::Alignment; }
145 -+static inline unsigned alignOf() { return AlignOf<T>::Alignment; }
146 -
147 -diff --git a/libclamav/c++/llvm/include/llvm/Support/Allocator.h b/libclamav/c++/llvm/include/llvm/Support/Allocator.h
148 -index 4a7251f..17caf5e 100644
149 ---- a/libclamav/c++/llvm/include/llvm/Support/Allocator.h
150 -+++ b/libclamav/c++/llvm/include/llvm/Support/Allocator.h
151 -@@ -203,3 +203,3 @@ public:
152 - for (char *Ptr = (char*)(Slab+1); Ptr < End; Ptr += sizeof(T)) {
153 -- Ptr = Allocator.AlignPtr(Ptr, alignof<T>());
154 -+ Ptr = Allocator.AlignPtr(Ptr, alignOf<T>());
155 - if (Ptr + sizeof(T) <= End)
156 -diff --git a/libclamav/c++/llvm/lib/Analysis/ScalarEvolution.cpp b/libclamav/c++/llvm/lib/Analysis/ScalarEvolution.cpp
157 -index b892d85..dc72346 100644
158 ---- a/libclamav/c++/llvm/lib/Analysis/ScalarEvolution.cpp
159 -+++ b/libclamav/c++/llvm/lib/Analysis/ScalarEvolution.cpp
160 -@@ -495,3 +495,3 @@ void SCEVUnknown::print(raw_ostream &OS) const {
161 - if (isAlignOf(AllocTy)) {
162 -- OS << "alignof(" << *AllocTy << ")";
163 -+ OS << "alignOf(" << *AllocTy << ")";
164 - return;
165 -diff --git a/libclamav/c++/llvm/lib/Target/X86/X86CodeEmitter.cpp b/libclamav/c++/llvm/lib/Target/X86/X86CodeEmitter.cpp
166 -index 824021c..757ca50 100644
167 ---- a/libclamav/c++/llvm/lib/Target/X86/X86CodeEmitter.cpp
168 -+++ b/libclamav/c++/llvm/lib/Target/X86/X86CodeEmitter.cpp
169 -@@ -569,3 +569,3 @@ void Emitter<CodeEmitter>::emitMemModRMByte(const MachineInstr &MI,
170 - // Calculate what the SS field value should be...
171 -- static const unsigned SSTable[] = { ~0, 0, 1, ~0, 2, ~0, ~0, ~0, 3 };
172 -+ static const unsigned SSTable[] = { ~0u, 0u, 1u, ~0u, 2u, ~0u, ~0u, ~0u, 3u };
173 - unsigned SS = SSTable[Scale.getImm()];
174 -diff --git a/libclamav/c++/llvm/lib/Target/X86/X86MCCodeEmitter.cpp b/libclamav/c++/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
175 -index 9564fe0..b2b7986 100644
176 ---- a/libclamav/c++/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
177 -+++ b/libclamav/c++/llvm/lib/Target/X86/X86MCCodeEmitter.cpp
178 -@@ -332,3 +332,3 @@ void X86MCCodeEmitter::EmitMemModRMByte(const MCInst &MI, unsigned Op,
179 - // Calculate what the SS field value should be...
180 -- static const unsigned SSTable[] = { ~0, 0, 1, ~0, 2, ~0, ~0, ~0, 3 };
181 -+ static const unsigned SSTable[] = { ~0u, 0u, 1u, ~0u, 2u, ~0u, ~0u, ~0u, 3u };
182 - unsigned SS = SSTable[Scale.getImm()];
183 -diff --git a/libclamav/mpool.c b/libclamav/mpool.c
184 -index cd38e15..b5e537d 100644
185 ---- a/libclamav/mpool.c
186 -+++ b/libclamav/mpool.c
187 -@@ -417,3 +417,3 @@ static size_t from_bits(unsigned int bits) {
188 -
189 --static inline unsigned int alignof(size_t size)
190 -+static inline unsigned int alignOf(size_t size)
191 - {
192 -@@ -609,3 +609,3 @@ static void* allocate_aligned(struct MPMAP *mpm, size_t size, unsigned align, co
193 - void *mpool_malloc(struct MP *mp, size_t size) {
194 -- size_t align = alignof(size);
195 -+ size_t align = alignOf(size);
196 - size_t i, needed = align_increase(size+FRAG_OVERHEAD, align);
197
198 diff --git a/app-antivirus/clamav/files/clamav-0.99.2-pcre2-compile-erroffset.patch b/app-antivirus/clamav/files/clamav-0.99.2-pcre2-compile-erroffset.patch
199 deleted file mode 100644
200 index 1ee55171afb..00000000000
201 --- a/app-antivirus/clamav/files/clamav-0.99.2-pcre2-compile-erroffset.patch
202 +++ /dev/null
203 @@ -1,12 +0,0 @@
204 ---- clamav-0.99.2/libclamav/regex_pcre.c~ 2017-11-28 14:40:56.484208243 +0100
205 -+++ clamav-0.99.2/libclamav/regex_pcre.c 2017-11-28 14:41:07.301207800 +0100
206 -@@ -112,7 +112,8 @@ int cli_pcre_addoptions(struct cli_pcre_
207 - #if USING_PCRE2
208 - int cli_pcre_compile(struct cli_pcre_data *pd, long long unsigned match_limit, long long unsigned match_limit_recursion, unsigned int options, int opt_override)
209 - {
210 -- int errornum, erroffset;
211 -+ int errornum;
212 -+ size_t erroffset;
213 - pcre2_general_context *gctx;
214 - pcre2_compile_context *cctx;
215 -
216
217 diff --git a/app-antivirus/clamav/files/clamav-0.99.2-tinfo.patch b/app-antivirus/clamav/files/clamav-0.99.2-tinfo.patch
218 deleted file mode 100644
219 index 4593d16836e..00000000000
220 --- a/app-antivirus/clamav/files/clamav-0.99.2-tinfo.patch
221 +++ /dev/null
222 @@ -1,23 +0,0 @@
223 ---- a/m4/reorganization/clamdtop.m4
224 -+++ b/m4/reorganization/clamdtop.m4
225 -@@ -4,12 +4,20 @@
226 -
227 - if test "$enable_clamdtop" != "no"; then
228 -
229 -+PKG_CHECK_MODULES([CURSES],[ncurses],
230 -+ [HAVE_LIBNCURSES=yes; CURSES_INCLUDE="<ncurses.h>"],
231 -+ [HAVE_LIBNCURSES=no],
232 -+)
233 -+
234 -+if test "X$HAVE_LIBNCURSES" != "Xyes"; then
235 -+ HAVE_LIBNCURSES=
236 - AC_LIB_FIND([ncurses], [ncurses/ncurses.h],
237 - AC_LANG_PROGRAM([#include <ncurses/ncurses.h>],
238 - [initscr(); KEY_RESIZE;]),
239 - [CURSES_CPPFLAGS="$INCNCURSES"; CURSES_LIBS="$LTLIBNCURSES";
240 - CURSES_INCLUDE="<ncurses/ncurses.h>"],
241 - [])
242 -+fi
243 -
244 - if test "X$HAVE_LIBNCURSES" != "Xyes"; then
245 - HAVE_LIBNCURSES=
246
247 diff --git a/app-antivirus/clamav/files/clamav-0.99.3-VMSF_DELTA-fix-CVE-2012-6706.patch b/app-antivirus/clamav/files/clamav-0.99.3-VMSF_DELTA-fix-CVE-2012-6706.patch
248 deleted file mode 100644
249 index 90facf6eae0..00000000000
250 --- a/app-antivirus/clamav/files/clamav-0.99.3-VMSF_DELTA-fix-CVE-2012-6706.patch
251 +++ /dev/null
252 @@ -1,186 +0,0 @@
253 -Apply proposed changes to fix RAR VMSF_DELTA Filter Signedness error (CVE-2012-6706)
254 -
255 -Cherry picked from commit a7d8447bd9a4d5ae1fa970c1849c8caeb5f1a805 [Link 1] and
256 -d4699442bce76574573dc564e7f2177d679b88bd [Link 2].
257 -
258 -Link 1: https://github.com/Cisco-Talos/clamav-devel/commit/a7d8447bd9a4d5ae1fa970c1849c8caeb5f1a805
259 -Link 2: https://github.com/Cisco-Talos/clamav-devel/commit/d4699442bce76574573dc564e7f2177d679b88bd
260 -
261 ---- a/libclamunrar/unrarvm.c
262 -+++ b/libclamunrar/unrarvm.c
263 -@@ -213,17 +213,20 @@ void rarvm_addbits(rarvm_input_t *rarvm_input, int bits)
264 -
265 - unsigned int rarvm_getbits(rarvm_input_t *rarvm_input)
266 - {
267 -- unsigned int bit_field;
268 -+ unsigned int bit_field = 0;
269 -
270 -- if (rarvm_input->in_addr+2 < rarvm_input->buf_size) {
271 -+ if (rarvm_input->in_addr < rarvm_input->buf_size) {
272 - bit_field = (unsigned int) rarvm_input->in_buf[rarvm_input->in_addr] << 16;
273 -- bit_field |= (unsigned int) rarvm_input->in_buf[rarvm_input->in_addr+1] << 8;
274 -- bit_field |= (unsigned int) rarvm_input->in_buf[rarvm_input->in_addr+2];
275 -- bit_field >>= (8-rarvm_input->in_bit);
276 --
277 -- return (bit_field & 0xffff);
278 -+ if (rarvm_input->in_addr+1 < rarvm_input->buf_size) {
279 -+ bit_field |= (unsigned int) rarvm_input->in_buf[rarvm_input->in_addr+1] << 8;
280 -+ if (rarvm_input->in_addr+2 < rarvm_input->buf_size) {
281 -+ bit_field |= (unsigned int) rarvm_input->in_buf[rarvm_input->in_addr+2];
282 -+ }
283 -+ }
284 - }
285 -- return 0;
286 -+ bit_field >>= (8-rarvm_input->in_bit);
287 -+
288 -+ return (bit_field & 0xffff);
289 - }
290 -
291 - unsigned int rarvm_read_data(rarvm_input_t *rarvm_input)
292 -@@ -311,10 +314,10 @@ static unsigned int *rarvm_get_operand(rarvm_data_t *rarvm_data,
293 - }
294 - }
295 -
296 --static unsigned int filter_itanium_getbits(unsigned char *data, int bit_pos, int bit_count)
297 -+static unsigned int filter_itanium_getbits(unsigned char *data, unsigned int bit_pos, unsigned int bit_count)
298 - {
299 -- int in_addr=bit_pos/8;
300 -- int in_bit=bit_pos&7;
301 -+ unsigned int in_addr=bit_pos/8;
302 -+ unsigned int in_bit=bit_pos&7;
303 - unsigned int bit_field=(unsigned int)data[in_addr++];
304 - bit_field|=(unsigned int)data[in_addr++] << 8;
305 - bit_field|=(unsigned int)data[in_addr++] << 16;
306 -@@ -323,10 +326,10 @@ static unsigned int filter_itanium_getbits(unsigned char *data, int bit_pos, int
307 - return(bit_field & (0xffffffff>>(32-bit_count)));
308 - }
309 -
310 --static void filter_itanium_setbits(unsigned char *data, unsigned int bit_field, int bit_pos, int bit_count)
311 -+static void filter_itanium_setbits(unsigned char *data, unsigned int bit_field, unsigned int bit_pos, unsigned int bit_count)
312 - {
313 -- int i, in_addr=bit_pos/8;
314 -- int in_bit=bit_pos&7;
315 -+ unsigned int i, in_addr=bit_pos/8;
316 -+ unsigned int in_bit=bit_pos&7;
317 - unsigned int and_mask=0xffffffff>>(32-bit_count);
318 - and_mask=~(and_mask<<in_bit);
319 -
320 -@@ -343,11 +346,12 @@ static void filter_itanium_setbits(unsigned char *data, unsigned int bit_field,
321 - static void execute_standard_filter(rarvm_data_t *rarvm_data, rarvm_standard_filters_t filter_type)
322 - {
323 - unsigned char *data, cmp_byte2, cur_byte, *src_data, *dest_data;
324 -- int i, j, data_size, channels, src_pos, dest_pos, border, width, PosR;
325 -- int op_type, cur_channel, byte_count, start_pos, pa, pb, pc;
326 -+ unsigned int i, j, data_size, channels, src_pos, dest_pos, border, width, PosR;
327 -+ unsigned int op_type, cur_channel, byte_count, start_pos;
328 -+ int pa, pb, pc;
329 - unsigned int file_offset, cur_pos, predicted;
330 -- int32_t offset, addr;
331 -- const int file_size=0x1000000;
332 -+ uint32_t offset, addr;
333 -+ const unsigned int file_size=0x1000000;
334 -
335 - switch(filter_type) {
336 - case VMSF_E8:
337 -@@ -356,7 +360,7 @@ static void execute_standard_filter(rarvm_data_t *rarvm_data, rarvm_standard_fil
338 - data_size = rarvm_data->R[4];
339 - file_offset = rarvm_data->R[6];
340 -
341 -- if (((unsigned int)data_size >= VM_GLOBALMEMADDR) || (data_size < 4)) {
342 -+ if ((data_size > VM_GLOBALMEMADDR) || (data_size < 4)) {
343 - break;
344 - }
345 -
346 -@@ -367,12 +371,14 @@ static void execute_standard_filter(rarvm_data_t *rarvm_data, rarvm_standard_fil
347 - if (cur_byte==0xe8 || cur_byte==cmp_byte2) {
348 - offset = cur_pos+file_offset;
349 - addr = GET_VALUE(FALSE, data);
350 -- if (addr < 0) {
351 -- if (addr+offset >=0 ) {
352 -+ // We check 0x80000000 bit instead of '< 0' comparison
353 -+ // not assuming int32 presence or uint size and endianness.
354 -+ if ((addr & 0x80000000)!=0) { // addr<0
355 -+ if (((addr+offset) & 0x80000000)==0) { // addr+offset>=0
356 - SET_VALUE(FALSE, data, addr+file_size);
357 - }
358 - } else {
359 -- if (addr<file_size) {
360 -+ if (((addr-file_size) & 0x80000000)!=0) { // addr<file_size
361 - SET_VALUE(FALSE, data, addr-offset);
362 - }
363 - }
364 -@@ -386,7 +392,7 @@ static void execute_standard_filter(rarvm_data_t *rarvm_data, rarvm_standard_fil
365 - data_size = rarvm_data->R[4];
366 - file_offset = rarvm_data->R[6];
367 -
368 -- if (((unsigned int)data_size >= VM_GLOBALMEMADDR) || (data_size < 21)) {
369 -+ if ((data_size > VM_GLOBALMEMADDR) || (data_size < 21)) {
370 - break;
371 - }
372 -
373 -@@ -429,7 +435,7 @@ static void execute_standard_filter(rarvm_data_t *rarvm_data, rarvm_standard_fil
374 - border = data_size*2;
375 -
376 - SET_VALUE(FALSE, &rarvm_data->mem[VM_GLOBALMEMADDR+0x20], data_size);
377 -- if ((unsigned int)data_size >= VM_GLOBALMEMADDR/2) {
378 -+ if (data_size > VM_GLOBALMEMADDR/2 || channels > 1024 || channels == 0) {
379 - break;
380 - }
381 - for (cur_channel=0 ; cur_channel < channels ; cur_channel++) {
382 -@@ -440,7 +446,7 @@ static void execute_standard_filter(rarvm_data_t *rarvm_data, rarvm_standard_fil
383 - }
384 - break;
385 - case VMSF_RGB: {
386 -- const int channels=3;
387 -+ const unsigned int channels=3;
388 - data_size = rarvm_data->R[4];
389 - width = rarvm_data->R[0] - 3;
390 - PosR = rarvm_data->R[1];
391 -@@ -448,15 +454,14 @@ static void execute_standard_filter(rarvm_data_t *rarvm_data, rarvm_standard_fil
392 - dest_data = src_data + data_size;
393 -
394 - SET_VALUE(FALSE, &rarvm_data->mem[VM_GLOBALMEMADDR+0x20], data_size);
395 -- if ((unsigned int)data_size >= VM_GLOBALMEMADDR/2) {
396 -+ if (data_size > VM_GLOBALMEMADDR/2 || data_size < 3 || width > data_size || PosR > 2) {
397 - break;
398 - }
399 - for (cur_channel=0 ; cur_channel < channels; cur_channel++) {
400 - unsigned int prev_byte = 0;
401 - for (i=cur_channel ; i<data_size ; i+=channels) {
402 -- int upper_pos=i-width;
403 -- if (upper_pos >= 3) {
404 -- unsigned char *upper_data = dest_data+upper_pos;
405 -+ if (i >= width+3) {
406 -+ unsigned char *upper_data = dest_data+i-width;
407 - unsigned int upper_byte = *upper_data;
408 - unsigned int upper_left_byte = *(upper_data-3);
409 - predicted = prev_byte+upper_byte-upper_left_byte;
410 -@@ -486,13 +491,14 @@ static void execute_standard_filter(rarvm_data_t *rarvm_data, rarvm_standard_fil
411 - break;
412 - }
413 - case VMSF_AUDIO: {
414 -- int channels=rarvm_data->R[0];
415 -+ unsigned int channels=rarvm_data->R[0];
416 - data_size = rarvm_data->R[4];
417 - src_data = rarvm_data->mem;
418 - dest_data = src_data + data_size;
419 -
420 - SET_VALUE(FALSE, &rarvm_data->mem[VM_GLOBALMEMADDR+0x20], data_size);
421 -- if ((unsigned int)data_size >= VM_GLOBALMEMADDR/2) {
422 -+ // In fact, audio channels never exceed 4.
423 -+ if (data_size > VM_GLOBALMEMADDR/2 || channels > 128 || channels == 0) {
424 - break;
425 - }
426 - for (cur_channel=0 ; cur_channel < channels ; cur_channel++) {
427 -@@ -553,7 +559,7 @@ static void execute_standard_filter(rarvm_data_t *rarvm_data, rarvm_standard_fil
428 - data_size = rarvm_data->R[4];
429 - src_pos = 0;
430 - dest_pos = data_size;
431 -- if ((unsigned int)data_size >= VM_GLOBALMEMADDR/2) {
432 -+ if (data_size > VM_GLOBALMEMADDR/2) {
433 - break;
434 - }
435 - while (src_pos < data_size) {
436 ---
437 -2.16.2
438 -
439
440 diff --git a/app-antivirus/clamav/files/clamav-0.99.3-fix-fd-leaks-in-cli_scanscript.patch b/app-antivirus/clamav/files/clamav-0.99.3-fix-fd-leaks-in-cli_scanscript.patch
441 deleted file mode 100644
442 index a457a71758c..00000000000
443 --- a/app-antivirus/clamav/files/clamav-0.99.3-fix-fd-leaks-in-cli_scanscript.patch
444 +++ /dev/null
445 @@ -1,132 +0,0 @@
446 -Author: Manuel Mausz <manuel-clamav@×××××.at>
447 -
448 -http://lists.clamav.net/pipermail/clamav-users/2018-January/005687.html
449 -
450 ---- clamav-0.99.3/libclamav/scanners.c.orig 2018-01-26 14:35:23.299386703 +0100
451 -+++ clamav-0.99.3/libclamav/scanners.c 2018-01-26 14:47:44.422451335 +0100
452 -@@ -1342,39 +1342,35 @@
453 - return CL_CLEAN;
454 - }
455 -
456 -- /* dump to disk only if explicitly asked to
457 -- * or if necessary to check relative offsets,
458 -- * otherwise we can process just in-memory */
459 -- if(ctx->engine->keeptmp || (troot && troot->ac_reloff_num > 0)) {
460 -- if((ret = cli_gentempfd(ctx->engine->tmpdir, &tmpname, &ofd))) {
461 -- cli_dbgmsg("cli_scanscript: Can't generate temporary file/descriptor\n");
462 -- return ret;
463 -- }
464 -- if (ctx->engine->keeptmp)
465 -- cli_dbgmsg("cli_scanscript: saving normalized file to %s\n", tmpname);
466 -- }
467 --
468 - if(!(normalized = cli_malloc(SCANBUFF + maxpatlen))) {
469 - cli_dbgmsg("cli_scanscript: Unable to malloc %u bytes\n", SCANBUFF);
470 -- free(tmpname);
471 - return CL_EMEM;
472 - }
473 --
474 - text_normalize_init(&state, normalized, SCANBUFF + maxpatlen);
475 -- ret = CL_CLEAN;
476 --
477 -
478 - if ((ret = cli_ac_initdata(&tmdata, troot?troot->ac_partsigs:0, troot?troot->ac_lsigs:0, troot?troot->ac_reloff_num:0, CLI_DEFAULT_AC_TRACKLEN))) {
479 -- free(tmpname);
480 -+ free(normalized);
481 - return ret;
482 - }
483 -
484 - if ((ret = cli_ac_initdata(&gmdata, groot->ac_partsigs, groot->ac_lsigs, groot->ac_reloff_num, CLI_DEFAULT_AC_TRACKLEN))) {
485 - cli_ac_freedata(&tmdata);
486 -- free(tmpname);
487 -+ free(normalized);
488 - return ret;
489 - }
490 -
491 -+ /* dump to disk only if explicitly asked to
492 -+ * or if necessary to check relative offsets,
493 -+ * otherwise we can process just in-memory */
494 -+ if(ctx->engine->keeptmp || (troot && troot->ac_reloff_num > 0)) {
495 -+ if((ret = cli_gentempfd(ctx->engine->tmpdir, &tmpname, &ofd))) {
496 -+ cli_dbgmsg("cli_scanscript: Can't generate temporary file/descriptor\n");
497 -+ goto done;
498 -+ }
499 -+ if (ctx->engine->keeptmp)
500 -+ cli_dbgmsg("cli_scanscript: saving normalized file to %s\n", tmpname);
501 -+ }
502 -+
503 - mdata[0] = &tmdata;
504 - mdata[1] = &gmdata;
505 -
506 -@@ -1388,9 +1384,8 @@
507 -
508 - if (write(ofd, state.out, state.out_pos) == -1) {
509 - cli_errmsg("cli_scanscript: can't write to file %s\n",tmpname);
510 -- close(ofd);
511 -- free(tmpname);
512 -- return CL_EWRITE;
513 -+ ret = CL_EWRITE;
514 -+ goto done;
515 - }
516 - text_normalize_reset(&state);
517 - }
518 -@@ -1409,11 +1404,6 @@
519 - funmap(*ctx->fmap);
520 - }
521 - *ctx->fmap = map;
522 --
523 -- /* If we aren't keeping temps, delete the normalized file after scan. */
524 -- if(!(ctx->engine->keeptmp))
525 -- if (cli_unlink(tmpname)) ret = CL_EUNLINK;
526 --
527 - } else {
528 - /* Since the above is moderately costly all in all,
529 - * do the old stuff if there's no relative offsets. */
530 -@@ -1421,11 +1411,8 @@
531 - if (troot) {
532 - cli_targetinfo(&info, 7, map);
533 - ret = cli_ac_caloff(troot, &tmdata, &info);
534 -- if (ret) {
535 -- cli_ac_freedata(&tmdata);
536 -- free(tmpname);
537 -- return ret;
538 -- }
539 -+ if (ret)
540 -+ goto done;
541 - }
542 -
543 - while(1) {
544 -@@ -1466,13 +1453,6 @@
545 -
546 - }
547 -
548 -- if(ctx->engine->keeptmp) {
549 -- free(tmpname);
550 -- if (ofd >= 0)
551 -- close(ofd);
552 -- }
553 -- free(normalized);
554 --
555 - if(ret != CL_VIRUS || SCAN_ALL) {
556 - if ((ret = cli_exp_eval(ctx, troot, &tmdata, NULL, NULL)) == CL_VIRUS)
557 - viruses_found++;
558 -@@ -1481,9 +1461,19 @@
559 - viruses_found++;
560 - }
561 -
562 -+done:
563 -+ free(normalized);
564 - cli_ac_freedata(&tmdata);
565 - cli_ac_freedata(&gmdata);
566 -
567 -+ if (ofd != -1)
568 -+ close(ofd);
569 -+ if (tmpname != NULL) {
570 -+ if (!ctx->engine->keeptmp)
571 -+ if (cli_unlink(tmpname)) ret = CL_EUNLINK;
572 -+ free(tmpname);
573 -+ }
574 -+
575 - if (SCAN_ALL && viruses_found)
576 - return CL_VIRUS;
577 -