[vlc-devel] help patch

Rémi Denis-Courmont remi at remlab.net
Mon Sep 3 12:54:39 CEST 2012


Le lundi 3 septembre 2012 13:22:42, armand bendanan a écrit :
> > Le dimanche 2 septembre 2012 17:56:56, armand bendanan a écrit :
> > > With the help of drmemory ( <http://code.google.com/p/drmemory>
> > > http://code.google.com/p/drmemory), I found a crash problem for vlc -H
> > > in the git version.
> > > 
> > > contrib/win32/x264/x264.h define:
> > > static const char * const x264_profile_names[] = { "baseline", "main",
> > > "high", "high10", "high422", "high444", 0 }; The last item is here 0.
> > > This is not the only case where a list is 0 terminated.
> > 
> > That's a bug in the x264 plugin. NULL items are not permitted.
> 
> In src/modules/entry.c, the vlc_plugin_setter function already handle NULL
> items for String lists by testing src[i] and avoiding strdup(NULL): case
> VLC_CONFIG_LIST:
>         {
>             size_t len = va_arg (ap, size_t);
>             ........
>             if (IsConfigStringType (item->i_type))
>             {
>                 const char *const *src = va_arg (ap, const char *const *);
>                 char **dst = xmalloc (sizeof (char *) * len);
> 
>                 for (size_t i = 0; i < len; i++)
>                      dst[i] = src[i] ? strdup (src[i]) : NULL;
>                 item->list.psz = dst;
>             ........
> 
> Why NULL items should be permitted in vlc_plugin_setter function and not in
> help Usage function?

In this particular case, the NULL value marks the end of the list. It's not a 
choice. Thus it is a bug in x264.c in any case:
The NULL choice should not be presented to the user.

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list