[vlc-devel] Possible bug
tony
hugh1234 at mail.ustc.edu.cn
Tue Aug 11 06:43:57 CEST 2015
In /source/vlc/src/input/input.c, in function LoadSubtitles,
there's following code:
if( i_attachment > 0 )
var_Create( p_input, "sub-description", VLC_VAR_STRING );
for( int i = 0; i < i_attachment; i++ )
{
input_attachment_t *a = pp_attachment[i];
if( !a )
continue;
char *psz_mrl;
if( a->psz_name[i] &&
asprintf( &psz_mrl, "attachment://%s", a->psz_name ) >= 0 )
{
var_SetString( p_input, "sub-description",
a->psz_description ? a->psz_description : "");
input_SubtitleAdd( p_input, psz_mrl, i_flags );
i_flags = SUB_NOFLAG;
free( psz_mrl );
}
vlc_input_attachment_Delete( a );
}
Now, a is the i th attachment, a->psz_name is just a c string,
then why would we check a->psz_name[i]?
If the string is zero length, shouldn't we check
a->psz_name[0] instead?
Since I don't fully understand it yet,
I'm not entirely sure the author's intention.
More information about the vlc-devel
mailing list