From: "A.Appleyard" To: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU Date: Wed, 25 Oct 1995 10:57:00 GMT Subject: Re: An apparent fault in GZIP "A.Appleyard" wrote (Subject: An apparent fault in GZIP):- > ... Here follows a program that I just wrote that successfully unzips a > PKZIP file that contains one file, which must have been packed by shrinking > ... > #include Sorry. A corrigendum. These lines:- else if(c==2) {pc++; for(m=256;m<0x10000;m++) b[a[m]]|=0x8000; for(m=0;m<0x10000;m++) if(b[m]&0x8000) b[m]&=0x7fff; else a[m]=b[m]=0; for(q=257;b[q];q++) if(q>=0x10000) break /* MOAN */;} for(l=0,j=c;j>255;j=j==q?p:a[j]) w[l++]=b[j]; w[l++]=j; a[q]=p; b[q]=j; if(c==q) w[0]=j; pn[q]=pc; should read:- else if(c==2) {pc++; for(m=256;m<0x10000;m++) b[m]&=0x7fff; for(m=256;m<0x10000;m++) if(a[m]>255) b[a[m]]|=0x8000; for(m=0;m<0x10000;m++) if(b[m]>=0) a[m]=b[m]=0; for(q=257;b[q];q++) if(q>=0x10000) break /* MOAN */;} for(l=0,j=c;j>255;j=j==q?p:a[j]) w[l++]=b[j]; w[l++]=j; a[q]=p; b[q]=j|0x8000; if(c==q) w[0]=j; pn[q]=pc; or trouble may happen if the file is long or longish and contains \000 bytes.