indeo4: fix null ptr dereference
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 31 Mar 2012 21:31:56 +0000 (23:31 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 31 Mar 2012 21:31:56 +0000 (23:31 +0200)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/indeo4.c

index 3dd58dc..0fe5f8f 100644 (file)
@@ -519,7 +519,7 @@ static int decode_mb_info(IVI4DecContext *ctx, IVIBandDesc *band,
                 }
 
                 mb->mv_x = mb->mv_y = 0; /* no motion vector coded */
-                if (band->inherit_mv) {
+                if (band->inherit_mv && ref_mb) {
                     /* motion vector inheritance */
                     if (mv_scale) {
                         mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
@@ -553,7 +553,7 @@ static int decode_mb_info(IVI4DecContext *ctx, IVIBandDesc *band,
                 if (!mb->type) {
                     mb->mv_x = mb->mv_y = 0; /* there is no motion vector in intra-macroblocks */
                 } else {
-                    if (band->inherit_mv) {
+                    if (band->inherit_mv && ref_mb) {
                         /* motion vector inheritance */
                         if (mv_scale) {
                             mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);