[FFmpeg-cvslog] avcodec/h264_sei: Try to make code more robust by jumping to the specified SEI ends

Michael Niedermayer git at videolan.org
Mon Jul 22 02:54:54 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jul 21 19:34:28 2013 +0200| [682e8a694f6ce0fd83af73b828593d99412ad928] | committer: Michael Niedermayer

avcodec/h264_sei: Try to make code more robust by jumping to the specified SEI ends

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

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

 libavcodec/h264_sei.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 9c97c18..999fce7 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -245,7 +245,7 @@ static int decode_frame_packing(H264Context *h, int size){
 int ff_h264_decode_sei(H264Context *h){
     while (get_bits_left(&h->gb) > 16) {
         int type;
-        unsigned size;
+        unsigned size, next;
 
         type=0;
         do{
@@ -268,6 +268,7 @@ int ff_h264_decode_sei(H264Context *h){
             av_log(h->avctx, AV_LOG_ERROR, "SEI truncated\n");
             return AVERROR_INVALIDDATA;
         }
+        next = get_bits_count(&h->gb) + 8*size;
 
         switch(type){
         case SEI_TYPE_PIC_TIMING: // Picture timing SEI
@@ -293,9 +294,8 @@ int ff_h264_decode_sei(H264Context *h){
         case SEI_TYPE_FRAME_PACKING:
             if(decode_frame_packing(h, size) < 0)
                 return -1;
-        default:
-            skip_bits_long(&h->gb, 8*size);
         }
+        skip_bits_long(&h->gb, next - get_bits_count(&h->gb));
 
         //FIXME check bits here
         align_get_bits(&h->gb);



More information about the ffmpeg-cvslog mailing list