[FFmpeg-cvslog] avcodec/gifdec: skip the data lzw consumed

Ni Hui git at videolan.org
Tue Nov 10 23:24:26 CET 2015


ffmpeg | branch: master | Ni Hui <shuizhuyuanluo at 126.com> | Tue Nov 10 22:03:36 2015 +0800| [3ea60c505f3f6d489d31170d1fb40b4083c5074d] | committer: Michael Niedermayer

avcodec/gifdec: skip the data lzw consumed

this fixes the return code of avcodec_decode_video2 for gif decoding
and the gif frame data buffer is skipped properly

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3ea60c505f3f6d489d31170d1fb40b4083c5074d
---

 libavcodec/gifdec.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
index 9f2e6eb..20ae903 100644
--- a/libavcodec/gifdec.c
+++ b/libavcodec/gifdec.c
@@ -130,7 +130,7 @@ static void gif_copy_img_rect(const uint32_t *src, uint32_t *dst,
 static int gif_read_image(GifState *s, AVFrame *frame)
 {
     int left, top, width, height, bits_per_pixel, code_size, flags, pw;
-    int is_interleaved, has_local_palette, y, pass, y1, linesize, pal_size;
+    int is_interleaved, has_local_palette, y, pass, y1, linesize, pal_size, lzwed_len;
     uint32_t *ptr, *pal, *px, *pr, *ptr1;
     int ret;
     uint8_t *idx;
@@ -293,7 +293,8 @@ static int gif_read_image(GifState *s, AVFrame *frame)
 
  decode_tail:
     /* read the garbage data until end marker is found */
-    ff_lzw_decode_tail(s->lzw);
+    lzwed_len = ff_lzw_decode_tail(s->lzw);
+    bytestream2_skipu(&s->gb, lzwed_len);
 
     /* Graphic Control Extension's scope is single frame.
      * Remove its influence. */



More information about the ffmpeg-cvslog mailing list