avcodec/h264_mp4toannexb_bsf: Reorder operations in nal_size check

Fixes Ticket4778

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2bb54b82b5)
This commit is contained in:
Michael Niedermayer 2015-08-21 02:49:21 +02:00 committed by Carl Eugen Hoyos
parent 30c644afeb
commit 17788711ac
1 changed files with 1 additions and 1 deletions

View File

@ -150,7 +150,7 @@ pps:
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;
/* prepend only to the first type 5 NAL unit of an IDR picture */