vc1: prevent null pointer dereference on broken files

Message ID 20120201122352.7CE2C5DC84@aruru.libav.org
State New
Headers show

Commit Message

Janne Grunau Feb. 1, 2012, 12:23 p.m.
Module: libav
Branch: master
Commit: 510ef04a461b3b54a762c6141ad880cbed85981f

Author:    Janne Grunau <janne-libav@jannau.net>
Committer: Janne Grunau <janne-libav@jannau.net>
Date:      Wed Jan 25 15:49:54 2012 +0100

vc1: prevent null pointer dereference on broken files

CC: libav-stable@libav.org

---

 libavcodec/vc1dec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 325cc64..417bd04 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -5709,7 +5709,7 @@  static int vc1_decode_frame(AVCodecContext *avctx, void *data,
             if (!v->field_mode || v->second_field)
                 s->end_mb_y = (i == n_slices     ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);
             else
-                s->end_mb_y = (i == n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);
+                s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height);
             vc1_decode_blocks(v);
             if (i != n_slices)
                 s->gb = slices[i].gb;