[vlc-devel] [PATCH] mkv: ebml_dispatcher: fix ebmlid check

Hugo Beauzée-Luyssen hugo at beauzee.fr
Thu Jun 18 12:05:32 CEST 2020


LGTM

On Thu, Jun 18, 2020, at 11:44 AM, Alexandre Janniaux wrote:
> 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 processer 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.
> ---
>  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 8d1e7a60538..985bb4565d6 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;
>          }
> -- 
> 2.27.0
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list