GNOME Bugzilla – Bug 742639
region: fix a crash when iterating locales
Last modified: 2015-01-10 03:45:20 UTC
See patch
Created attachment 294150 [details] [review] region: fix a crash when iterating locales When iterating locales in the format chooser, gnome_get_country_from_locale() is called for each of them to build the locale label for the list row. The function creating the label doesn't take into account that gnome_get_country_from_locale() can return NULL, in which case it will both: - display an empty row in the list - crash when later trying to find a word in a NULL string with strstr() inside match_all() Just avoid creating a widget in that case.
Review of attachment 294150 [details] [review]: What caused gnome_get_country_from_locale() to return NULL? I'll let Rui review the patch.
It can return NULL when gnome_parse_locale() returns NULL on one of its out arguments; I haven't investigated exactly why that is the case on the system I saw this crash, but perhaps there's one locale installed on the system with incomplete information. In any case, since the API can return NULL it doesn't seem a bad idea to be robust to it...
Review of attachment 294150 [details] [review]: looks good, thanks
(In reply to comment #3) > It can return NULL when gnome_parse_locale() returns NULL on one of its out > arguments; I haven't investigated exactly why that is the case on the system I > saw this crash, but perhaps there's one locale installed on the system with > incomplete information. > In any case, since the API can return NULL it doesn't seem a bad idea to be > robust to it... Yes that's true. There's no way around it since the locale string can just be incomplete or even totally bogus and thus it can't determine the country.
Thanks, pushed to master. Attachment 294150 [details] pushed as eb93004 - region: fix a crash when iterating locales