mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-19 20:08:28 +01:00
gif2webp: fix segfault on OOM
previously calls to WebPPictureCopy() weren't checked, causing a crash when the canvas copies were accessed later in the loop Tested: for i in `seq 1 1125`; do export MALLOC_FAIL_AT=$i ./examples/gif2webp gif_file ./examples/gif2webp -mixed gif_file done Change-Id: I186d13be0ec8f3b72b7d247a8482590c1b1be541
This commit is contained in:
parent
0957fd69ee
commit
e471728754
@ -314,8 +314,11 @@ int main(int argc, const char* argv[]) {
|
||||
frame.use_argb = 1;
|
||||
if (!WebPPictureAlloc(&frame)) goto End;
|
||||
GIFClearPic(&frame, NULL);
|
||||
WebPPictureCopy(&frame, &curr_canvas);
|
||||
WebPPictureCopy(&frame, &prev_canvas);
|
||||
if (!(WebPPictureCopy(&frame, &curr_canvas) &&
|
||||
WebPPictureCopy(&frame, &prev_canvas))) {
|
||||
fprintf(stderr, "Error allocating canvas.\n");
|
||||
goto End;
|
||||
}
|
||||
|
||||
// Background color.
|
||||
GIFGetBackgroundColor(gif->SColorMap, gif->SBackGroundColor,
|
||||
|
Loading…
Reference in New Issue
Block a user