summaryrefslogtreecommitdiff
path: root/deflate_medium.c
diff options
context:
space:
mode:
Diffstat (limited to 'deflate_medium.c')
-rw-r--r--deflate_medium.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/deflate_medium.c b/deflate_medium.c
index dad550c..59ccfa8 100644
--- a/deflate_medium.c
+++ b/deflate_medium.c
@@ -210,7 +210,7 @@ Z_INTERNAL block_state deflate_medium(deflate_state *s, int flush) {
*/
dist = (int64_t)s->strstart - hash_head;
- if (dist <= MAX_DIST(s) && dist > 0) {
+ if (dist <= MAX_DIST(s) && dist > 0 && hash_head != 0) {
/* 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).
@@ -245,7 +245,7 @@ Z_INTERNAL block_state deflate_medium(deflate_state *s, int flush) {
*/
dist = (int64_t)s->strstart - hash_head;
- if (dist <= MAX_DIST(s) && dist > 0) {
+ if (dist <= MAX_DIST(s) && dist > 0 && hash_head != 0) {
/* 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).