[pulseaudio-discuss] Patch for segfault on Solaris 8 (NULL pointers)
ossman at cendio.se
Tue Mar 6 05:51:16 PST 2007
Kevin Mescher wrote:
> I think there are a few options for fixing this:
> 1. Fix the pa_strbuf_printf function to go through the format string, and for every %s, check and correct any NULL pointer. I'm not sure how to do this one.
> 2. Fix each call to pa_strbuf_printf. This is not difficult, but would be tedious, as there are quite a few of these calls (example in cli-text.patch)
> 3. Change pa_xstrdup to return an empty string if it's given a NULL pointer. While not an exact duplication of a NULL pointer, it would be much cleaner, and more portable (example in xmalloc.patch)
> I would recommend option 3, as it permanently adjusts the NULL strings before they propogate anywhere. There would be no need to correct any calls to pa_strbuf_printf, provided that ONLY strings created from pa_xstrdup were used.
I'd say that is a wonderful way to get entirely confusing code. Calling
printf-esque functions with an invalid string is a bug and should be
dealt with accordingly. I.e. option 2 is the correct solution.
Pierre Ossman OpenSource-based Thin Client Technology
System Developer Telephone: +46-13-21 46 00
Cendio AB Web: http://www.cendio.com
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 251 bytes
Desc: OpenPGP digital signature
More information about the pulseaudio-discuss