[vlc-devel] help patch

armand bendanan armand.bendanan at free.fr
Sun Sep 2 16:56:56 CEST 2012



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

modules/codec/x264.c calls:
change_string_list( x264_profile_names, x264_profile_names )
which compute the size of the list with:
(size_t)(sizeof (list) / sizeof (char *))
Here the size of the list (p_item->list_count) is one more than needed
because of the NULL item at the end of the x264_profile_names list.

src/config/help.c use for CONFIG_ITEM_STRING:
for( i = 0; i < p_item->list_count; i++ )
if( i ) strcat( psz_buffer, "," );
strcat( psz_buffer, p_item->list.psz[i] );
The strcat fail for the last NULL item.

We have to add the following in the loop:
if( p_item->list.psz[i] == NULL ) break;

if( p_item->list_text[i] == NULL ) break;


Here is an attached patch.



Armand Bendanan


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20120902/ddf14631/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patche.txt
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20120902/ddf14631/attachment.txt>

More information about the vlc-devel mailing list