[vlc-devel] help patch

armand bendanan armand.bendanan at free.fr
Mon Sep 3 12:22:42 CEST 2012


> 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?

I can suggest to modify vlc_plugin_setter, decrementing the length (len variable) of the list when it is NULL terminated instead of pushing a NULL value in item->list.psz, is it correct to do this way?

> 
> Patching the VLC core is wrong.





More information about the vlc-devel mailing list