OSDN Git Service

Don't abort when the ffmpeg vc1 decoder hands us a bogus packet size
authorvan <van@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 18 Nov 2008 04:24:11 +0000 (04:24 +0000)
committervan <van@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 18 Nov 2008 04:24:11 +0000 (04:24 +0000)
git-svn-id: svn://localhost/HandBrake/trunk@1925 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/stream.c

index 0a336ec..e531d60 100755 (executable)
@@ -2685,6 +2685,13 @@ static int ffmpeg_read( hb_stream_t *stream, hb_buffer_t *buf )
     {
         if ( stream->ffmpeg_pkt->size > buf->alloc )
         {
+            // sometimes we get absurd sizes from ffmpeg
+            if ( stream->ffmpeg_pkt->size >= (1 << 25) )
+            {
+                hb_log( "ffmpeg_read: pkt too big: %d bytes", stream->ffmpeg_pkt->size );
+                av_free_packet( stream->ffmpeg_pkt );
+                return ffmpeg_read( stream, buf );
+            }
             // need to expand buffer
             hb_buffer_realloc( buf, stream->ffmpeg_pkt->size );
         }