Lines 1-44
Link Here
|
1 |
--- libclamav/bytecode_api.c.orig 2016-04-22 15:02:19 UTC |
|
|
2 |
+++ libclamav/bytecode_api.c |
3 |
@@ -811,8 +811,19 @@ int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx, |
4 |
cli_dbgmsg("bytecode api: inflate_init: invalid buffers!\n"); |
5 |
return -1; |
6 |
} |
7 |
- memset(&stream, 0, sizeof(stream)); |
8 |
- ret = inflateInit2(&stream, windowBits); |
9 |
+ b = cli_realloc(ctx->inflates, sizeof(*ctx->inflates)*n); |
10 |
+ if (!b) { |
11 |
+ return -1; |
12 |
+ } |
13 |
+ ctx->inflates = b; |
14 |
+ ctx->ninflates = n; |
15 |
+ b = &b[n-1]; |
16 |
+ |
17 |
+ b->from = from; |
18 |
+ b->to = to; |
19 |
+ b->needSync = 0; |
20 |
+ memset(&b->stream, 0, sizeof(stream)); |
21 |
+ ret = inflateInit2(&b->stream, windowBits); |
22 |
switch (ret) { |
23 |
case Z_MEM_ERROR: |
24 |
cli_dbgmsg("bytecode api: inflateInit2: out of memory!\n"); |
25 |
@@ -830,19 +841,6 @@ int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx, |
26 |
return -1; |
27 |
} |
28 |
|
29 |
- b = cli_realloc(ctx->inflates, sizeof(*ctx->inflates)*n); |
30 |
- if (!b) { |
31 |
- inflateEnd(&stream); |
32 |
- return -1; |
33 |
- } |
34 |
- ctx->inflates = b; |
35 |
- ctx->ninflates = n; |
36 |
- b = &b[n-1]; |
37 |
- |
38 |
- b->from = from; |
39 |
- b->to = to; |
40 |
- b->needSync = 0; |
41 |
- memcpy(&b->stream, &stream, sizeof(stream)); |
42 |
return n-1; |
43 |
} |
44 |
|