[FFmpeg-cvslog] mpeg12_parser: make mpegvideo_split() more robust

Michael Niedermayer git at videolan.org
Tue Oct 18 14:17:29 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Oct 18 14:08:06 2011 +0200| [73fb23dc5a5b0d91491c8c4645134e2f7a9e6965] | committer: Michael Niedermayer

mpeg12_parser: make mpegvideo_split() more robust
I just found this issue while debuging, i dont have a testcase.

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

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

 libavcodec/mpegvideo_parser.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index bcbe1f1..25028a9 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -164,10 +164,13 @@ static int mpegvideo_split(AVCodecContext *avctx,
 {
     int i;
     uint32_t state= -1;
+    int found=0;
 
     for(i=0; i<buf_size; i++){
         state= (state<<8) | buf[i];
-        if(state != 0x1B3 && state != 0x1B5 && state < 0x200 && state >= 0x100)
+        if(state == 0x1B3){
+            found=1;
+        }else if(found && state != 0x1B5 && state < 0x200 && state >= 0x100)
             return i-3;
     }
     return 0;



More information about the ffmpeg-cvslog mailing list