[vlc-devel] [vlc-commits] demux: ttml: probe extra namespaces

Rémi Denis-Courmont remi at remlab.net
Thu Apr 27 20:08:25 CEST 2017


Le torstaina 27. huhtikuuta 2017, 18.04.23 EEST Francois Cartegnie a écrit :
> vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Apr 27
> 20:02:44 2017 +0200| [4f3195a340bd1a405e0f4f260ad9f45d0352aceb] |
> committer: Francois Cartegnie
> 
> demux: ttml: probe extra namespaces
> 
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4f3195a340bd1a405e0
> > f4f260ad9f45d0352aceb
> ---
> 
>  modules/demux/ttml.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
> index 791af45d72..14c9ffcea8 100644
> --- a/modules/demux/ttml.c
> +++ b/modules/demux/ttml.c
> @@ -440,8 +440,19 @@ int OpenDemux( vlc_object_t* p_this )
>      }
>      else
>      {
> -        const char *psz_ns = strnstr( psz_xml,
> "=\"http://www.w3.org/ns/ttml\"", -                                     
> i_xml -( (ptrdiff_t)psz_tt - (ptrdiff_t)psz_xml ) ); +        const char *
> const rgsz[] =
> +        {
> +            "=\"http://www.w3.org/ns/ttml\"",
> +            "=\"http://www.w3.org/2004/11/ttaf1\"",
> +            "=\"http://www.w3.org/2006/04/ttaf1\"",
> +            "=\"http://www.w3.org/2006/10/ttaf1\"",
> +        };
> +        const char *psz_ns;
> +        for( size_t i=0; i<ARRAY_SIZE(rgsz) && !psz_ns; i++ )
> +        {
> +            psz_ns = strnstr( psz_xml, rgsz[i],
> +                              i_xml -( (ptrdiff_t)psz_tt -
> (ptrdiff_t)psz_xml ) );

If the two pointer are in the same table, the cast is completely wrong. And 
otherwise, this is undefined.

Either way, this cannot be right (but you systematically ignore review 
comments of late).

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list