fix #2778: encode_chunk_repeat reads out of range memory

This commit is contained in:
IntelOrca 2016-01-19 17:54:51 +00:00
parent 9cf4707f57
commit 24a796c3bc
1 changed files with 1 additions and 1 deletions

View File

@ -417,7 +417,7 @@ static size_t encode_chunk_repeat(const uint8 *src_buffer, uint8 *dst_buffer, si
bestRepeatCount = 0;
for (repeatIndex = searchIndex; repeatIndex <= searchEnd; repeatIndex++) {
repeatCount = 0;
maxRepeatCount = min(7, searchEnd - repeatIndex);
maxRepeatCount = min(min(7, searchEnd - repeatIndex), length - i - 1);
for (j = 0; j <= maxRepeatCount; j++) {
assert(repeatIndex + j < length);
assert(i + j < length);