[vlc-commits] mkv: ebml_dispatcher: fix ebmlid check

Alexandre Janniaux git at videolan.org
Mon Jun 22 13:40:58 CEST 2020


vlc/vlc-3.0 | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Thu Jun 18 11:39:53 2020 +0200| [30b3534ff0a326b61c1b75439f72e2982bb8ba23] | committer: Steve Lhomme

mkv: ebml_dispatcher: fix ebmlid check

std::lower_bound doesn't return an iterator to the std::end value if the
element is not found, but like its name says, to the first value that is
greater or equal than the value wanted, meaning it could be the next one
if no processor has been bound to the ebml id sent to this dispatcher.

Instead of asserting, it should really be checking whether the ebmlid
matches.

Regression from c764461180d70d1c9fa81e72cd7ad9d9b289eea6.

(cherry picked from commit 20ed34f45803c1171c7219d72a4284fa1d0d7852)

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=30b3534ff0a326b61c1b75439f72e2982bb8ba23
---

 modules/demux/mkv/Ebml_dispatcher.hpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mkv/Ebml_dispatcher.hpp b/modules/demux/mkv/Ebml_dispatcher.hpp
index a5df19eccc..c58e5801ce 100644
--- a/modules/demux/mkv/Ebml_dispatcher.hpp
+++ b/modules/demux/mkv/Ebml_dispatcher.hpp
@@ -88,9 +88,11 @@ namespace {
             _processors.begin(), cit_end, eb
         );
 
-        if (cit != cit_end)
+        /* Check that the processor is valid and unique. */
+        if (cit != cit_end &&
+            cit->p_ebmlid == eb.p_ebmlid &&
+            (*cit->p_ebmlid == *eb.p_ebmlid))
         {
-            assert(cit->p_ebmlid == eb.p_ebmlid || (*cit->p_ebmlid == *eb.p_ebmlid));
             cit->callback (element, payload);
             return true;
         }



More information about the vlc-commits mailing list