[vlc-commits] [Git][videolan/vlc][master] 3 commits: demux: mkv: read data from KaxBlockAdditions as const

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Nov 11 11:40:46 UTC 2024



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
c03249a0 by Steve Lhomme at 2024-11-11T11:21:12+00:00
demux: mkv: read data from KaxBlockAdditions as const

We should not be able to modify what we read.

- - - - -
e3adf173 by Steve Lhomme at 2024-11-11T11:21:12+00:00
demux: mkv: don't expose local BlockDecode function

- - - - -
f7c0d247 by Steve Lhomme at 2024-11-11T11:21:12+00:00
demux: mkv: fix potential leak of KaxBlockAdditions when seeking

- - - - -


3 changed files:

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


Changes:

=====================================
modules/demux/mkv/matroska_segment_seeker.cpp
=====================================
@@ -372,7 +372,11 @@ SegmentSeeker::index_unsearched_range( matroska_segment_c& ms, Range search_area
 
         if( ms.BlockGet( block, simpleblock, additions,
                          &b_key_picture, &b_discardable_picture, &i_block_duration ) )
+        {
+            delete additions;
             break;
+        }
+        delete additions;
 
         KaxInternalBlock& internal_block = simpleblock
             ? static_cast<KaxInternalBlock&>( *simpleblock )


=====================================
modules/demux/mkv/mkv.cpp
=====================================
@@ -537,8 +537,8 @@ static void ReleaseVpxAlpha(void *opaque)
 }
 
 /* Needed by matroska_segment::Seek() and Seek */
-void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock,
-                  KaxBlockAdditions *additions,
+static void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock,
+                  const KaxBlockAdditions *additions,
                   vlc_tick_t i_pts, int64_t i_duration, bool b_key_picture,
                   bool b_discardable_picture )
 {
@@ -654,10 +654,10 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
                 size_t i_addition = 0;
                 if(additions)
                 {
-                    KaxBlockMore *blockmore = FindChild<KaxBlockMore>(*additions);
+                    auto blockmore = FindChild<const KaxBlockMore>(*additions);
                     if(blockmore)
                     {
-                        KaxBlockAdditional *addition = FindChild<KaxBlockAdditional>(*blockmore);
+                        auto addition = FindChild<const KaxBlockAdditional>(*blockmore);
                         if(addition)
                         {
                             i_addition = static_cast<std::string::size_type>(addition->GetSize());
@@ -705,16 +705,16 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
         case VLC_CODEC_VP9:
             if (additions && track.fmt.i_level) // contains alpha extradata
             {
-                KaxBlockMore *blockMore = FindChild<KaxBlockMore>(*additions);
+                auto blockMore = FindChild<const KaxBlockMore>(*additions);
                 if(blockMore == nullptr)
                     break;
-                KaxBlockAddID *addId = FindChild<KaxBlockAddID>(*blockMore);
+                auto addId = FindChild<const KaxBlockAddID>(*blockMore);
                 if(addId == nullptr)
                     break;
                 if (static_cast<uint64_t>(*addId) != 1)
                     break;
 
-                KaxBlockAdditional *addition = FindChild<KaxBlockAdditional>(*blockMore);
+                auto addition = FindChild<const KaxBlockAdditional>(*blockMore);
                 if(addition == nullptr)
                     break;
 


=====================================
modules/demux/mkv/mkv.hpp
=====================================
@@ -158,11 +158,6 @@ Type * FindNextChild(const EbmlMaster & Master, const Type & PastElt)
 
 using namespace libmatroska;
 
-void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock,
-                  KaxBlockAdditions *additions,
-                  vlc_tick_t i_pts, vlc_tick_t i_duration, bool b_key_picture,
-                  bool b_discardable_picture );
-
 class matroska_segment_c;
 struct matroska_stream_c
 {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2e4b474815dad0bd2a9d1e274610670665989fbd...f7c0d24733350e4c43a2dcb84e3106d9e2be9e7b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2e4b474815dad0bd2a9d1e274610670665989fbd...f7c0d24733350e4c43a2dcb84e3106d9e2be9e7b
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