nuv: check buffer size before checking content.
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 17 Apr 2012 17:32:04 +0000 (19:32 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 17 Apr 2012 17:32:04 +0000 (19:32 +0200)
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/nuv.c

index 4bc236d..bb236d1 100644 (file)
@@ -191,7 +191,7 @@ retry:
     }
     if (c->codec_frameheader) {
         int w, h, q, res;
-        if (buf[0] != 'V' || buf_size < 12) {
+        if (buf_size < 12 || buf[0] != 'V') {
             av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame (wrong codec_tag?)\n");
             return AVERROR_INVALIDDATA;
         }