1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

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

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);