mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 835325 - Clean up and return from BootAnimation PNG reader when libpng reports an error, r=mwu
This commit is contained in:
parent
e11eef4753
commit
b952bab533
@ -297,8 +297,22 @@ AnimationFrame::ReadPngFrame(int outputFormat)
|
||||
png_structp pngread = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||
nullptr, nullptr, nullptr);
|
||||
|
||||
if (!pngread)
|
||||
return;
|
||||
|
||||
png_infop pnginfo = png_create_info_struct(pngread);
|
||||
|
||||
if (!pnginfo) {
|
||||
png_destroy_read_struct(&pngread, &pnginfo, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (setjmp(png_jmpbuf(pngread))) {
|
||||
// libpng reported an error and longjumped here. Clean up and return.
|
||||
png_destroy_read_struct(&pngread, &pnginfo, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
RawReadState state;
|
||||
state.start = file->GetData();
|
||||
state.length = file->GetDataSize();
|
||||
@ -306,8 +320,6 @@ AnimationFrame::ReadPngFrame(int outputFormat)
|
||||
|
||||
png_set_read_fn(pngread, &state, RawReader);
|
||||
|
||||
setjmp(png_jmpbuf(pngread));
|
||||
|
||||
png_read_info(pngread, pnginfo);
|
||||
|
||||
width = png_get_image_width(pngread, pnginfo);
|
||||
|
Loading…
Reference in New Issue
Block a user