avcodec/h264_mp4toannexb_bsf: Reorder operations in nal_size check
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 21 Aug 2015 00:49:21 +0000 (02:49 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 21 Aug 2015 01:37:32 +0000 (03:37 +0200)
Fixes Ticket4778

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/h264_mp4toannexb_bsf.c

index 1693989..a5da84a 100644 (file)
@@ -201,7 +201,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
         buf      += ctx->length_size;
         unit_type = *buf & 0x1f;
 
-        if (buf + nal_size > buf_end || nal_size < 0)
+        if (nal_size > buf_end - buf || nal_size < 0)
             goto fail;
 
         if (unit_type == 7)