mirror of https://github.com/libsdl-org/SDL.git
fix stbi__parse_png_file() reading too much bytes (thanks @miniupnp!)
just "rewind" the bytes that have been read past the IEND chunk.
This commit is contained in:
parent
db4e6c1931
commit
e6a24fcbb5
|
|
@ -5465,6 +5465,10 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp, unsigned i
|
||||||
STBI_FREE(z->expanded); z->expanded = NULL;
|
STBI_FREE(z->expanded); z->expanded = NULL;
|
||||||
// end of PNG chunk, read and skip CRC
|
// end of PNG chunk, read and skip CRC
|
||||||
stbi__get32be(s);
|
stbi__get32be(s);
|
||||||
|
if (s->io.skip && s->img_buffer_end > s->img_buffer) {
|
||||||
|
// rewind the additional bytes that have been read to the buffer
|
||||||
|
(s->io.skip)(s->io_user_data, (int)(s->img_buffer - s->img_buffer_end));
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue