[FFmpeg-cvslog] h264: prevent an out of array read in decode_nal_units()

Michael Niedermayer git at videolan.org
Sun Sep 11 07:30:07 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Sep 11 07:23:00 2011 +0200| [ea0ac11e52b9cf5264f3d4eb7543e760c2a5fbb4] | committer: Michael Niedermayer

h264: prevent an out of array read in decode_nal_units()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/h264.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 958c859..0703c6b 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3646,7 +3646,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
             s->workaround_bugs |= FF_BUG_TRUNCATED;
 
         if(!(s->workaround_bugs & FF_BUG_TRUNCATED)){
-        while(ptr[dst_length - 1] == 0 && dst_length > 0)
+        while(dst_length > 0 && ptr[dst_length - 1] == 0)
             dst_length--;
         }
         bit_length= !dst_length ? 0 : (8*dst_length - ff_h264_decode_rbsp_trailing(h, ptr + dst_length - 1));



More information about the ffmpeg-cvslog mailing list