nuv: check size of buffer before accessing it instead of after.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Tue, 31 Jul 2012 18:32:38 +0000 (20:32 +0200)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Wed, 1 Aug 2012 17:35:58 +0000 (19:35 +0200)
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
libavcodec/nuv.c

index bb236d1..17fcb70 100644 (file)
@@ -164,7 +164,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
         return orig_size;
     }
 
-    if (buf[0] != 'V' || buf_size < 12) {
+    if (buf_size < 12 || buf[0] != 'V') {
         av_log(avctx, AV_LOG_ERROR, "not a nuv video frame\n");
         return -1;
     }