snow: reject unsupported chroma shifts.
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Mar 2012 23:08:32 +0000 (00:08 +0100)
committerReinhard Tartler <siretart@tauware.de>
Wed, 14 Mar 2012 20:34:55 +0000 (21:34 +0100)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit c9837954e7b968d44f82e7cdb7618e9f523b196c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
libavcodec/snowdec.c

index 2b6f6e1..d9f61bc 100644 (file)
@@ -327,6 +327,11 @@ static int decode_header(SnowContext *s){
         return -1;
     }
 
+    if (s->chroma_h_shift != 1 || s->chroma_v_shift != 1) {
+        av_log(s->avctx, AV_LOG_ERROR, "Invalid chroma shift\n");
+        return AVERROR_PATCHWELCOME;
+    }
+
     s->qlog           += get_symbol(&s->c, s->header_state, 1);
     s->mv_scale       += get_symbol(&s->c, s->header_state, 1);
     s->qbias          += get_symbol(&s->c, s->header_state, 1);