mirror of https://github.com/OpenRCT2/OpenRCT2.git
fix #2778: encode_chunk_repeat reads out of range memory
This commit is contained in:
parent
9cf4707f57
commit
24a796c3bc
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue