24 lines
845 B
Diff
24 lines
845 B
Diff
From 9429e20de3885c0e0d9beac23f703fce58461021 Mon Sep 17 00:00:00 2001
|
|
From: Szabolcs Berecz <szabolcs.berecz@gmail.com>
|
|
Date: Sun, 25 Oct 2015 22:43:25 +0100
|
|
Subject: [PATCH] Fix invalid read outsize allocated memory
|
|
|
|
The invalid read happens when compressing a 1 byte file.
|
|
---
|
|
src/zopfli/hash.c | 3 +--
|
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
|
|
|
diff --git a/src/zopfli/hash.c b/src/zopfli/hash.c
|
|
index a3b294fa..66528aa5 100644
|
|
--- a/src/zopfli/hash.c
|
|
+++ b/src/zopfli/hash.c
|
|
@@ -129,7 +129,6 @@ void ZopfliUpdateHash(const unsigned char* array, size_t pos, size_t end,
|
|
|
|
void ZopfliWarmupHash(const unsigned char* array, size_t pos, size_t end,
|
|
ZopfliHash* h) {
|
|
- (void)end;
|
|
UpdateHashValue(h, array[pos + 0]);
|
|
- UpdateHashValue(h, array[pos + 1]);
|
|
+ if (pos + 1 < end) UpdateHashValue(h, array[pos + 1]);
|
|
}
|