[vlc-devel] Crash while seeking a Matroska file (Ticket #1006 et all) -fix
Harry Sintonen
sintonen at iki.fi
Wed May 9 03:32:42 CEST 2007
Hello!
I've tracked down the MKV seek crash to modules/demux/mkv.cpp
void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset )
The 'while( i_track_skipping > 0 )' -loop does BlockGet() to get the
'block'. However for LIBMATROSKA_VERSION >= 0x000800 it can happen that
the 'block' is NULL, resulting in NULL references later in the loop:
if( tracks[i_track]->i_number == block->TrackNum() )
and:
sys.i_pts = (sys.i_chapter_time + block->GlobalTimecode()) / (mtime_t) 1000;
I've included a proposed fix as an attachment (I bet those long lines
would barf).
In case the attachment is stripped down, it's temporarily here aswell:
http://www.iki.fi/sintonen/temp/mkv.cpp.diff.txt
Regards,
--
l=2001;main(i){float o,O,_,I,D;for(;O=I=l/571.-1.75,l;)for(putchar(--l%80?
i:10),o=D=l%80*.05-2,i=31;_=O*O,O=2*o*O+I,o=o*o-_+D,o+_+_<4+D&i++<87;);puts
(" Harry 'Piru' Sintonen <sintonen at iki.fi> http://www.iki.fi/sintonen");}
-------------- next part --------------
--- mkv.cpp.old Wed May 9 04:14:29 2007
+++ mkv.cpp Wed May 9 04:16:45 2007
@@ -5672,14 +5672,24 @@
ep->Down();
for( i_track = 0; i_track < tracks.size(); i_track++ )
{
+#if LIBMATROSKA_VERSION >= 0x000800
+ if( (simpleblock != NULL && tracks[i_track]->i_number == simpleblock->TrackNum()) ||
+ (block != NULL && tracks[i_track]->i_number == block->TrackNum()) )
+#else
if( tracks[i_track]->i_number == block->TrackNum() )
+#endif
{
break;
}
}
+#if LIBMATROSKA_VERSION >= 0x000800
+ if( simpleblock )
+ sys.i_pts = (sys.i_chapter_time + simpleblock->GlobalTimecode()) / (mtime_t) 1000;
+ else
+#endif
sys.i_pts = (sys.i_chapter_time + block->GlobalTimecode()) / (mtime_t) 1000;
if( i_track < tracks.size() )
{
More information about the vlc-devel
mailing list