delete trailing whitespace from control files
[debian/gzip] / inflate.c
index d5a8dfff5c54596ffcc58795ff25b8ec995844eb..bcafcf1a12368ce294aedd17eb30897561f023f6 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -1,6 +1,6 @@
 /* Inflate deflated data
 
-   Copyright (C) 1997-1999, 2002, 2006, 2009-2012 Free Software Foundation,
+   Copyright (C) 1997-1999, 2002, 2006, 2009-2018 Free Software Foundation,
    Inc.
 
    This program is free software; you can redistribute it and/or modify
  */
 
 #include <config.h>
-#include "tailor.h"
 
 #include <stdlib.h>
 
+#include "tailor.h"
 #include "gzip.h"
 #define slide window
 
@@ -219,13 +219,7 @@ static ush mask_bits[] = {
 
 #define GETBYTE() (inptr < insize ? inbuf[inptr++] : (wp = w, fill_inbuf(0)))
 
-#ifdef CRYPT
-  uch cc;
-#  define NEXTBYTE() \
-     (decrypt ? (cc = GETBYTE(), zdecode(cc), cc) : GETBYTE())
-#else
-#  define NEXTBYTE()  (uch)GETBYTE()
-#endif
+#define NEXTBYTE()  (uch)GETBYTE()
 #define NEEDBITS(n) {while(k<(n)){b|=((ulg)NEXTBYTE())<<k;k+=8;}}
 #define DUMPBITS(n) {b>>=(n);k-=(n);}
 
@@ -805,6 +799,12 @@ inflate_dynamic(void)
     NEEDBITS((unsigned)bl)
     j = (td = tl + ((unsigned)b & m))->b;
     DUMPBITS(j)
+    if (td->e == 99)
+      {
+        /* Invalid code.  */
+        huft_free (tl);
+        return 2;
+      }
     j = td->v.n;
     if (j < 16)                 /* length of code in bits (0..15) */
       ll[i++] = l = j;          /* save last length in l */