Browse code

avcodec/h264_mp4toannexb_bsf: Reorder operations in nal_size check

Fixes Ticket4778

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Michael Niedermayer authored on 2015/08/21 09:49:21
Showing 1 changed files
... ...
@@ -201,7 +201,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
201 201
         buf      += ctx->length_size;
202 202
         unit_type = *buf & 0x1f;
203 203
 
204
-        if (buf + nal_size > buf_end || nal_size < 0)
204
+        if (nal_size > buf_end - buf || nal_size < 0)
205 205
             goto fail;
206 206
 
207 207
         if (unit_type == 7)