[vlc-devel] [PATCH 3/3] Initialize title strings with non NULL pointer

Daniel Glaas daniel.glaas at freenet.de
Sat Jul 18 12:47:32 CEST 2020


In principle, looking over all possible use cases of strdup I agree that 
there might be case where strdup() returns NULL. But here I used it with 
an empty string as parameter, meaning that malloc() only needs to 
allocate one single byte in the memory. If this really fails, then there 
are other problems than only a wrong display of an RSS text overlay.

I also tried to add catches to the NULL pointers at those places where 
they are used. But in my opinion, this makes the places of usage very 
bad to read with a lot of NULL checks at various places. A lot of places 
in the *Filter() function rely on valid pointers where the titles are 
stored.

Am 18.07.20 um 09:41 schrieb Rémi Denis-Courmont:
> Le lauantaina 18. heinäkuuta 2020, 5.07.00 EEST Daniel Glaas a écrit :
>> Initialize title strings with non NULL pointer
>>
>> If no valid title could be parsed out of an RSS feed, the segmentation fault
>> caused VLC to crash. The reason therefore was that the expected pointers to
>> the char buffers containing the titles were NULL pointers.
> This won't work because strdup() can return NULL. Better handle the NULL
> values correctly.
>


More information about the vlc-devel mailing list