Fix crash reading corrupted files with invalid compressed data (fix #4171)

This commit is contained in:
David Capello 2023-11-26 22:27:14 -03:00
parent 7e331d95e2
commit 6f3e9e21ad

View File

@ -764,7 +764,7 @@ void read_compressed_image_templ(FileInterface* f,
size_t uncompressed_bytes = uncompressed.size() - zstream.avail_out;
if (uncompressed_bytes > 0) {
int i = 0;
while (true) {
while (y < image->height()) {
int n = std::min(uncompressed_bytes, scanline.size() - scanline_offset);
if (n > 0) {
// Fill the scanline buffer until it's completed