[vlc-devel] [PATCH] asx: fix SEGV when input isn't UTF8 or can't be XML encoded

Rémi Denis-Courmont remi at remlab.net
Thu Feb 1 18:16:14 CET 2018


Le jeudi 1 février 2018, 12:46:05 EET Pierre Lamot a écrit :
> @@ -547,23 +552,21 @@ static stream_t* PreparseStream( stream_t *p_demux )
>       } while ( streamSize > 0 );
>       psz_source[i_read] = 0;
> 
> +    if( !IsUTF8( psz_source ) )
> +    {
> +        char *psz_utf8 = FromLatin1( psz_source );
> +        free( psz_source );
> +        if( psz_utf8 == NULL )
> +            return NULL;
> +        psz_source = psz_utf8;
> +    }

The charset should be the one from the XML headers, if it exists, otherwise 
UTF-8. And if the byte sequence is not valid, then the broken file most likely 
uses whatever the so-called ANSI code page of the source Windows machine was.

Note that ISO_8859-1 is not a possible choice of ANSI code page on Windows 
(nor an OEM code page, FWIW).

-- 
Rémi Denis-Courmont


More information about the vlc-devel mailing list