cnd / rpms / gzip

Forked from rpms/gzip 3 years ago
Clone

Blame SOURCES/dfltcc-segfault.patch

f74b71
---
f74b71
 dfltcc.c | 14 ++++++++------
f74b71
 1 file changed, 8 insertions(+), 6 deletions(-)
f74b71
f74b71
diff --git a/dfltcc.c b/dfltcc.c
f74b71
index 86aa56e..3a5b92d 100644
f74b71
--- a/dfltcc.c
f74b71
+++ b/dfltcc.c
f74b71
@@ -242,10 +242,8 @@ dfltcc_gdht (struct dfltcc_param_v0 *param)
f74b71
   dfltcc (DFLTCC_GDHT, param, NULL, NULL, &next_in, &avail_in, NULL);
f74b71
 }
f74b71
 
f74b71
-static off_t total_in;
f74b71
-
f74b71
 static dfltcc_cc
f74b71
-dfltcc_cmpr_xpnd (struct dfltcc_param_v0 *param, int fn)
f74b71
+dfltcc_cmpr_xpnd (struct dfltcc_param_v0 *param, int fn, off_t *total_in)
f74b71
 {
f74b71
   uch *next_out = outbuf + outcnt;
f74b71
   size_t avail_out = OUTBUFSIZ - outcnt;
f74b71
@@ -257,7 +255,7 @@ dfltcc_cmpr_xpnd (struct dfltcc_param_v0 *param, int fn)
f74b71
                          window);
f74b71
   off_t consumed_in = next_in - (inbuf + inptr);
f74b71
   inptr += consumed_in;
f74b71
-  total_in += consumed_in;
f74b71
+  *total_in += consumed_in;
f74b71
   outcnt += ((OUTBUFSIZ - outcnt) - avail_out);
f74b71
   return cc;
f74b71
 }
f74b71
@@ -349,6 +347,7 @@ dfltcc_deflate (int pack_level)
f74b71
 
f74b71
   union aligned_dfltcc_param_v0 ctx_v0;
f74b71
   struct dfltcc_param_v0 *param = init_param (&ctx_v0);
f74b71
+  off_t total_in = 0;
f74b71
 
f74b71
   /* Compress ifd into ofd in a loop.  */
f74b71
   while (true)
f74b71
@@ -398,7 +397,8 @@ dfltcc_deflate (int pack_level)
f74b71
         }
f74b71
 
f74b71
       /* Compress inbuf into outbuf.  */
f74b71
-      while (dfltcc_cmpr_xpnd (param, DFLTCC_CMPR) == DFLTCC_CC_AGAIN)
f74b71
+      while (dfltcc_cmpr_xpnd (param, DFLTCC_CMPR, &total_in)
f74b71
+             == DFLTCC_CC_AGAIN)
f74b71
         ;
f74b71
 
f74b71
       /* Unmask the input data.  */
f74b71
@@ -427,6 +427,7 @@ dfltcc_inflate (void)
f74b71
 
f74b71
   union aligned_dfltcc_param_v0 ctx_v0;
f74b71
   struct dfltcc_param_v0 *param = init_param (&ctx_v0);
f74b71
+  off_t total_in = 0;
f74b71
 
f74b71
   /* Decompress ifd into ofd in a loop.  */
f74b71
   while (true)
f74b71
@@ -446,7 +447,8 @@ dfltcc_inflate (void)
f74b71
 
f74b71
         /* Decompress inbuf into outbuf.  */
f74b71
         dfltcc_cc cc;
f74b71
-        while ((cc = dfltcc_cmpr_xpnd (param, DFLTCC_XPND)) == DFLTCC_CC_AGAIN)
f74b71
+        while ((cc = dfltcc_cmpr_xpnd (param, DFLTCC_XPND, &total_in))
f74b71
+               == DFLTCC_CC_AGAIN)
f74b71
           ;
f74b71
         if (cc == DFLTCC_CC_OK)
f74b71
           {
f74b71
-- 
f74b71
2.25.4