[hackers] [flate] fix lzguard bug || nsz

From: <hg_AT_suckless.org>
Date: Sun, 23 Aug 2009 19:00:34 +0000 (UTC)

changeset: 117:3b5e4a1000de
user: nsz <nszabolcs_AT_gmail.com>
date: Sun Aug 23 20:06:20 2009 +0200
files: deflate.c
description:
fix lzguard bug

diff -r 3ae79c6d17c5 -r 3b5e4a1000de deflate.c
--- a/deflate.c Sun Aug 23 19:15:58 2009 +0200
+++ b/deflate.c Sun Aug 23 20:06:20 2009 +0200
@@ -560,7 +560,7 @@
 
 static int endblock(State *s) {
         if ((s->pos >= 2*WinSize && !shiftwin(s)) || s->pos - s->startpos >= BlockSize ||
- s->lzbuf - s->lz >= LzGuard || (s->eof && s->pos == s->endpos)) {
+ s->lz - s->lzbuf >= LzGuard || (s->eof && s->pos == s->endpos)) {
                 /* deflate block */
                 flushlit(s);
                 if (s->prevm.len)
@@ -619,8 +619,8 @@
         guard = calcguard(s);
 /*fprintf(stderr,"guard:%d pos:%d nin:%d\n", guard, s->pos, s->inend - s->in);*/
         for (;;) {
- if (s->pos >= guard || s->lzbuf - s->lz >= LzGuard) {
-/*fprintf(stderr,"guard:%d pos:%d len:%d end:%d start:%d nin:%d\n", guard, s->pos, s->pos - s->startpos, s->endpos, s->startpos, s->inend - s->in);*/
+ if (s->pos >= guard || s->lz - s->lzbuf >= LzGuard) {
+/*fprintf(stderr,"guard:%d pos:%d len:%d lzlen:%d end:%d start:%d nin:%d\n", guard, s->pos, s->pos - s->startpos, s->lz - s->lzbuf, s->endpos, s->startpos, s->inend - s->in);*/
                         if (endblock(s))
                                 return (s->state = FlateOut);
                         if (!fillsrc(s))
Received on Sun Aug 23 2009 - 19:00:34 UTC

This archive was generated by hypermail 2.2.0 : Sun Aug 23 2009 - 19:12:19 UTC