/[smeserver]/rpms/clamav/sme9/zlib-1.2.7-Fix-bug-where-gzopen-gzclose-would-write-an-empty-fi.patch
ViewVC logotype

Annotation of /rpms/clamav/sme9/zlib-1.2.7-Fix-bug-where-gzopen-gzclose-would-write-an-empty-fi.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Tue Nov 13 04:52:25 2018 UTC (5 years, 7 months ago) by jpp
Branch: MAIN
CVS Tags: clamav-0_100_2-4_el6_sme, clamav-0_100_2-3_el6_sme, clamav-0_100_2-6_el6_sme, clamav-0_100_2-5_el6_sme, HEAD
Changes since 1.1: +42 -489 lines
zlib patch

1 jpp 1.2 From 0cf495a1ca941428c0b11e2307cad760ae44993e Mon Sep 17 00:00:00 2001
2     From: Mark Adler <madler@alumni.caltech.edu>
3     Date: Sat, 29 Sep 2012 22:23:47 -0700
4     Subject: [PATCH] Fix bug where gzopen(), gzclose() would write an empty file.
5    
6     A gzopen() to write (mode "w") followed immediately by a gzclose()
7     would output an empty zero-length file. What it should do is write
8     an empty gzip file, with the gzip header, empty deflate content,
9     and gzip trailer totalling 20 bytes. This fixes it to do that.
10     ---
11     gzwrite.c | 15 +++++++--------
12     1 file changed, 7 insertions(+), 8 deletions(-)
13    
14     diff --git a/gzwrite.c b/gzwrite.c
15     index f53aace..79a69a5 100644
16     --- a/gzwrite.c
17     +++ b/gzwrite.c
18     @@ -554,15 +554,14 @@ int ZEXPORT gzclose_w(file)
19     }
20    
21     /* flush, free memory, and close file */
22     - if (state->size) {
23     - if (gz_comp(state, Z_FINISH) == -1)
24     - ret = state->err;
25     - if (!state->direct) {
26     - (void)deflateEnd(&(state->strm));
27     - free(state->out);
28     - }
29     - free(state->in);
30     + if (gz_comp(state, Z_FINISH) == -1)
31     + ret = state->err;
32     + if (!state->direct) {
33     + (void)deflateEnd(&(state->strm));
34     + free(state->out);
35     }
36     + if (state->size)
37     + free(state->in);
38     gz_error(state, Z_OK, NULL);
39     free(state->path);
40     if (close(state->fd) == -1)
41     --
42     1.9.3
43 jpp 1.1

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed