X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=unlzh.c;h=cda4ca351ab34f8fe16fe5b9fec7d380666b3b39;hb=26cd8af14e8b28ea287fd8342cba35bdc81c75f4;hp=7a88fee6294c3fde0b00bbef1c8fe7531481df2f;hpb=8ba3484138b5d1e72fd4ef49d27159263cb6bea6;p=debian%2Fgzip diff --git a/unlzh.c b/unlzh.c index 7a88fee..cda4ca3 100644 --- a/unlzh.c +++ b/unlzh.c @@ -3,10 +3,6 @@ * written by Haruhiko Okumura. */ -#ifdef RCSID -static char rcsid[] = "$Id: unlzh.c,v 1.2 1993/06/24 10:59:01 jloup Exp $"; -#endif - #include #include @@ -69,7 +65,7 @@ local void make_table OF((int nchar, uch bitlen[], #define NT (CODE_BIT + 3) #define PBIT 4 /* smallest integer such that (1U << PBIT) > NP */ #define TBIT 5 /* smallest integer such that (1U << TBIT) > NT */ -#define NPT (1< 1 << tablebits) - error("Bad table\n"); + if ((unsigned) 1 << tablebits < nextcode) + gzip_error ("Bad table\n"); for (i = start[len]; i < nextcode; i++) table[i] = ch; } else { k = start[len]; @@ -221,8 +217,8 @@ local void read_pt_len(nn, nbit, i_special) if (c == 7) { mask = (unsigned) 1 << (BITBUFSIZ - 1 - 3); while (mask & bitbuf) { mask >>= 1; c++; } - if (c > 16) - error("Bad table\n"); + if (16 < c) + gzip_error ("Bad table\n"); } fillbuf((c < 7) ? 3 : c - 3); pt_len[i++] = c;