[vlc-commits] mkv: ebml_dispatcher: fix ebmlid check
Alexandre Janniaux
git at videolan.org
Sat Jun 20 11:30:21 CEST 2020
vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Thu Jun 18 11:39:53 2020 +0200| [20ed34f45803c1171c7219d72a4284fa1d0d7852] | committer: Alexandre Janniaux
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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=20ed34f45803c1171c7219d72a4284fa1d0d7852
---
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 8d1e7a6053..985bb4565d 100644
--- a/modules/demux/mkv/Ebml_dispatcher.hpp
+++ b/modules/demux/mkv/Ebml_dispatcher.hpp
@@ -87,9 +87,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