bug-gzip
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] fix segfault encountered while compressing xorg fonts


From: Mike Frysinger
Subject: [patch] fix segfault encountered while compressing xorg fonts
Date: Thu, 7 Dec 2006 08:37:21 -0500
User-agent: KMail/1.9.5

this patch was taken from Debian to address some segfaults encountered while 
compressing xorg fonts on alpha systems ... relevant URLs can be found in the 
top of the patch
-mike

Attachment: pgplz0Bio60JO.pgp
Description: PGP signature

Taken from Debian.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=187417
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=184057
http://bugs.gentoo.org/92232

--- gzip-1.3.5.orig/deflate.c
+++ gzip-1.3.5/deflate.c
@@ -643,7 +643,8 @@
         /* Find the longest match, discarding those <= prev_length.
          * At this point we have always match_length < MIN_MATCH
          */
-        if (hash_head != NIL && strstart - hash_head <= MAX_DIST) {
+        if (hash_head != NIL && strstart - hash_head <= MAX_DIST &&
+            strstart <= window_size - MIN_LOOKAHEAD) {
             /* To simplify the code, we prevent matches with the string
              * of window index 0 (in particular we have to avoid a match
              * of the string with itself at the start of the input file).
@@ -737,7 +738,8 @@
         match_length = MIN_MATCH-1;
 
         if (hash_head != NIL && prev_length < max_lazy_match &&
-            strstart - hash_head <= MAX_DIST) {
+            strstart - hash_head <= MAX_DIST && 
+            strstart <= window_size - MIN_LOOKAHEAD) {
             /* To simplify the code, we prevent matches with the string
              * of window index 0 (in particular we have to avoid a match
              * of the string with itself at the start of the input file).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]