From b01681a93f8fa7803cbe94d8b6fcefb194bf9f45 Mon Sep 17 00:00:00 2001 From: Urvang Joshi Date: Tue, 29 Jan 2013 10:58:04 -0800 Subject: [PATCH] Fix for demuxer frame iteration: Return error in WebPDemuxGetFrame() when static method GetFrame() returns NULL. Change-Id: Idbc54037047c3df75209ac67ff8bede3f83042be --- src/demux/demux.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/demux/demux.c b/src/demux/demux.c index 40dbb291..18abcdee 100644 --- a/src/demux/demux.c +++ b/src/demux/demux.c @@ -8,6 +8,7 @@ // WebP container demux. // +#include #include #include @@ -754,6 +755,7 @@ static int SynthesizeFrame(const WebPDemuxer* const dmux, const uint8_t* const payload = GetFramePayload(mem_buf, fragment, &payload_size); if (payload == NULL) return 0; + assert(first_frame != NULL); iter->frame_num = first_frame->frame_num_; iter->num_frames = dmux->num_frames_; @@ -780,6 +782,8 @@ static int SetFrame(int frame_num, WebPIterator* const iter) { if (frame_num == 0) frame_num = dmux->num_frames_; frame = GetFrame(dmux, frame_num); + if (frame == NULL) return 0; + return SynthesizeFrame(dmux, frame, 1, iter); }