[FFmpeg-cvslog] avcodec/h264_mp4toannexb_bsf: Reorder operations in nal_size check

Michael Niedermayer git at videolan.org
Mon Aug 24 17:45:26 CEST 2015


ffmpeg | branch: release/2.4 | Michael Niedermayer <michael at niedermayer.cc> | Fri Aug 21 02:49:21 2015 +0200| [5b41bb29d73eaff18f7fd8e7efe78ec82578f5d0] | committer: Michael Niedermayer

avcodec/h264_mp4toannexb_bsf: Reorder operations in nal_size check

Fixes Ticket4778

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 2bb54b82b5094fd906aa28c0443be08c95662a31)

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5b41bb29d73eaff18f7fd8e7efe78ec82578f5d0
---

 libavcodec/h264_mp4toannexb_bsf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c
index 739ff95..c4f10f9 100644
--- a/libavcodec/h264_mp4toannexb_bsf.c
+++ b/libavcodec/h264_mp4toannexb_bsf.c
@@ -173,7 +173,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 || unit_type == 8)



More information about the ffmpeg-cvslog mailing list