Bug 675686 - segmentation fault in Region and Language, on NULL pointer given to strcmp
Summary: segmentation fault in Region and Language, on NULL pointer given to strcmp
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: control-center
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Control Center Maintainer
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-02-07 10:38 UTC by Alon Levy
Modified: 2014-08-04 22:08 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-02-07 19:07:07 UTC
Type: ---


Attachments (Terms of Use)

Description Alon Levy 2011-02-07 10:38:39 UTC
Description of problem:
Trying to switch to Region and Language gets a segmentation fault.

Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. open gnome-control-center
2. press Region and Language botton (under Personal)
  
Actual results:
segmentation fault

Expected results:
show region and language panel

Additional info:

The fault is in cc-common-language.c:83, calling:
result = strcmp(la, lb)
where lb == NULL

(gdb) p	ca
$1 = 0xd306d0 "zu_ZA.utf8"
(gdb) p	cb
$2 = 0xd31200 "hne_IN.utf8"
(gdb) p	la
$3 = 0xd30b00 "Zulu (South Africa)"
(gdb) p	lb
$4 = 0x0

context:
 77│
 78│         if (!ca)
 79│                 result = 1;
 80│         else if (!cb)
 81│                 result = -1;
 82│         else
 83├>                result = strcmp (la, lb);
 84│
 85│         g_free (ca);
 86│         g_free (cb);
 87│         g_free (la);
 88│         g_free (lb);
 89│
 90│         return result;



Backtrace:
(gdb) bt
#0  __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp.S:260
#1  0x00007fffde0720ab in cc_common_language_sort_languages (model=<value optimized out>, a=<value optimized out>, b=0x7fffffffdb90, data=<value opti
mized out>) at cc-common-language.c:83
#2  0x0000003175f5aeb5 in gtk_list_store_compare_func (a=0xd2b830, b=0xd2f720, user_data=0x8ff270) at gtkliststore.c:1805
#3  0x0000003175f5bcc2 in iter_is_sorted (list_store=0x8ff270 [GtkListStore], iter=<value optimized out>) at gtkliststore.c:1853
#4  gtk_list_store_sort_iter_changed (list_store=0x8ff270 [GtkListStore], iter=0x7fffffffdd50, column=<value optimized out>) at gtkliststore.c:1880
#5  0x0000003175f5d7f1 in gtk_list_store_set_valist (list_store=0x8ff270 [GtkListStore], iter=0x7fffffffdd50, var_args=0x7fffffffdc68) at gtkliststor
e.c:990
#6  0x0000003175f5d8d7 in gtk_list_store_set (list_store=<value optimized out>, iter=<value optimized out>) at gtkliststore.c:1026
#7  0x00007fffde072366 in cc_common_language_add_available_languages (store=0x8ff270 [GtkListStore], user_langs=0x9e29e0 = {...}) at cc-common-langua
ge.c:211
#8  0x00007fffde06c93e in finish_language_setup (user_data=0x8ce070) at	gnome-region-panel-lang.c:228
#9  0x0000003d87842b7d in g_main_dispatch (context=0x63aee0) at gmain.c:2440
#10 g_main_context_dispatch (context=0x63aee0) at gmain.c:3013
#11 0x0000003d87843358 in g_main_context_iterate (context=0x63aee0, block=<value optimized out>, dispatch=1, self=<value optimized out>) at gmain.c:3
091
#12 0x0000003d8784399a in g_main_loop_run (loop=0x7e1bc0) at gmain.c:3299
#13 0x0000003175f6002d in gtk_main () at gtkmain.c:1338
#14 0x0000003d88c952ae in g_application_run (application=0x7dea20 [GtkApplication], argc=<value optimized out>, argv=<value optimized out>) at gappli
cation.c:1219
#15 0x0000000000405771 in main (argc=1, argv=0x7fffffffe088) at control-center.c:152

Comment 1 Alon Levy 2011-02-07 10:41:29 UTC
Looks like just checking also if la == NULL or lb == NULL and returning -1 in that case should be fine (it can't be any worse then a segfault, and it looks like it would be the expected behavior anyway. Couldn't figure out why lb==NULL in the first place though..)

<sidenote>
I've already installed the debuginfo, otherwise I wouldn't have had the source and the ability to give you this nice stacktrace and local variable lookup. It would have been even nicer if I could try my fix (returning -1 if lb==NULL), but alas the debuginfo package doesn't contain the spec, make/configure, basically it lacks a little extra that would allow building a new rpm from it for test purposes. I think this should be fixed.
</sidenote>

Comment 2 Bastien Nocera 2011-02-07 19:07:07 UTC
Already fixed in 2.91.6-5. Thanks for the report.


Note You need to log in before you can comment on or make changes to this bug.