[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: demux: mkv: fix uncaught throw when reading Cluster first elements

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Sep 17 08:35:16 UTC 2025



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
e8e7274a by Steve Lhomme at 2025-09-17T08:00:25+00:00
demux: mkv: fix uncaught throw when reading Cluster first elements

Fixes https://code.videolan.org/videolan/vlc/-/issues/29288

- - - - -
3d6a8524 by Steve Lhomme at 2025-09-17T08:00:25+00:00
demux: mkv: fix uncaught throw when reading Block data

- - - - -


2 changed files:

- modules/demux/mkv/matroska_segment.cpp
- modules/demux/mkv/matroska_segment_seeker.cpp


Changes:

=====================================
modules/demux/mkv/matroska_segment.cpp
=====================================
@@ -1259,7 +1259,11 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
                 return;
             }
 
-            filepos_t read = ksblock.ReadData( vars.obj->es.I_O() );
+            filepos_t read = 0;
+            try {
+                read = ksblock.ReadData( vars.obj->es.I_O() );
+            } catch(...) {
+            }
             if (read == 0 && ksblock.GetSize() != 0) {
                 msg_Err( vars.p_demuxer,"Error while reading %s",  EBML_NAME(&ksblock) );
                 return;
@@ -1283,7 +1287,11 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
 
         E_CASE( KaxBlock, kblock )
         {
-            filepos_t read = kblock.ReadData( vars.obj->es.I_O() );
+            filepos_t read = 0;
+            try {
+                read = kblock.ReadData( vars.obj->es.I_O() );
+            } catch(...) {
+            }
             if (unlikely(read == 0) && kblock.GetSize() != 0) {
                 msg_Err( vars.p_demuxer,"Error while reading %s",  EBML_NAME(&kblock) );
                 return;


=====================================
modules/demux/mkv/matroska_segment_seeker.cpp
=====================================
@@ -510,16 +510,22 @@ SegmentSeeker::mkv_jump_to( matroska_segment_c& ms, fptr_t fpos )
 
     while( EbmlElement * el = ms.ep.Get() )
     {
-        if( MKV_CHECKED_PTR_DECL( p_tc, KaxClusterTimecode, el ) )
-        {
-            p_tc->ReadData( ms.es.I_O(), SCOPE_ALL_DATA );
-            ms.cluster->InitTimecode( static_cast<uint64>( *p_tc ), ms.i_timescale );
-            add_cluster(ms.cluster);
-            break;
+        try {
+            if( MKV_CHECKED_PTR_DECL( p_tc, KaxClusterTimecode, el ) )
+            {
+                p_tc->ReadData( ms.es.I_O(), SCOPE_ALL_DATA );
+                ms.cluster->InitTimecode( static_cast<uint64>( *p_tc ), ms.i_timescale );
+                add_cluster(ms.cluster);
+                break;
+            }
+            else if( MKV_CHECKED_PTR_DECL( p_tc, EbmlCrc32, el ) )
+            {
+                p_tc->ReadData( ms.es.I_O(), SCOPE_ALL_DATA ); /* avoid a skip that may fail */
+            }
         }
-        else if( MKV_CHECKED_PTR_DECL( p_tc, EbmlCrc32, el ) )
+        catch(...)
         {
-            p_tc->ReadData( ms.es.I_O(), SCOPE_ALL_DATA ); /* avoid a skip that may fail */
+            msg_Err( &ms.sys.demuxer,"Error while reading %s",  EBML_NAME(el) );
         }
     }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1e42a94883e4df237fa737573111f35e0c3f4c68...3d6a85245bf4db9ca32b138936311fd7613342df

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1e42a94883e4df237fa737573111f35e0c3f4c68...3d6a85245bf4db9ca32b138936311fd7613342df
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list