diracdec: check xybsep
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 18 Apr 2012 14:49:46 +0000 (16:49 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 18 Apr 2012 14:49:46 +0000 (16:49 +0200)
Fixes division by 0

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/diracdec.c

index b5395db..ad70fb2 100644 (file)
@@ -856,7 +856,7 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
     /*[DIRAC_STD] 11.2.4 motion_data_dimensions()
       Calculated in function dirac_unpack_block_motion_data */
 
-    if (s->plane[0].xbsep < s->plane[0].xblen/2 || s->plane[0].ybsep < s->plane[0].yblen/2) {
+    if (!s->plane[0].xbsep || !s->plane[0].ybsep || s->plane[0].xbsep < s->plane[0].xblen/2 || s->plane[0].ybsep < s->plane[0].yblen/2) {
         av_log(s->avctx, AV_LOG_ERROR, "Block separation too small\n");
         return -1;
     }