gzip/gzip-1.3.12-cve_2006_4338.patch

31 lines
957 B
Diff
Raw Normal View History

diff -ru gzip-1.3.12/unlzh.c gzip-1.3.12-fix/unlzh.c
--- gzip-1.3.12/unlzh.c 2007-04-18 22:19:06.000000000 +0200
+++ gzip-1.3.12-fix/unlzh.c 2007-04-18 22:20:42.000000000 +0200
@@ -259,7 +259,7 @@
if (bitbuf & mask) c = right[c];
else c = left [c];
mask >>= 1;
- } while (c >= NT);
+ } while (c >= NT && (mask || c != left[c]));
}
fillbuf((int) pt_len[c]);
if (c <= 2) {
@@ -295,7 +295,7 @@
if (bitbuf & mask) j = right[j];
else j = left [j];
mask >>= 1;
- } while (j >= NC);
+ } while (j >= NC && (mask || j != left[j]));
}
fillbuf((int) c_len[j]);
return j;
@@ -312,7 +312,7 @@
if (bitbuf & mask) j = right[j];
else j = left [j];
mask >>= 1;
- } while (j >= NP);
+ } while (j >= NP && (mask || j != left[j]));
}
fillbuf((int) pt_len[j]);
if (j != 0) j = ((unsigned) 1 << (j - 1)) + getbits((int) (j - 1));