Blame SOURCES/dfltcc-segfault.patch

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