After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 654539 - gnome-shell segfaults with invalid button_layout gconf key
gnome-shell segfaults with invalid button_layout gconf key
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
3.0.x
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2011-07-13 10:38 UTC by James
Modified: 2011-07-24 00:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
prefs: Initialize button_layout struct even on pref string corner cases (1.24 KB, patch)
2011-07-23 22:04 UTC, Rui Matos
reviewed Details | Review
prefs: Initialize button_layout struct even on pref string corner cases (1.78 KB, patch)
2011-07-23 23:20 UTC, Rui Matos
committed Details | Review

Description James 2011-07-13 10:38:56 UTC
gnome-shell segfaults when the ":" is missing from gconf key /desktop/gnome/shell/windows/button_layout. For example, if it's set to "minimize,close", gnome-shell crashes upon opening the first window.

gnome-shell-3.0.2-1.fc15 on x86-64, Intel X3100 graphics.
Comment 1 Rui Matos 2011-07-23 22:04:27 UTC
Created attachment 192543 [details] [review]
prefs: Initialize button_layout struct even on pref string corner cases

We were leaving some members of the button_layout struct uninitialized if the
pref string didn't have at least one colon or if it was an empty string ("").
Comment 2 Florian Müllner 2011-07-23 22:37:18 UTC
Review of attachment 192543 [details] [review]:

Looks good, minor style suggestion.

::: src/core/prefs.c
@@ +1742,3 @@
+    {
+      new_layout.left_buttons[0] = META_BUTTON_FUNCTION_LAST;
+      new_layout.left_buttons_has_spacer[0] = FALSE;

Code looks correct, but if you initialize i before the if block, you can just move

new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
new_layout.left_buttons_has_spacer[i] = FALSE;

below the block (e.g. no else{} needed).

@@ +1806,3 @@
+    {
+      new_layout.right_buttons[0] = META_BUTTON_FUNCTION_LAST;
+      new_layout.right_buttons_has_spacer[0] = FALSE;

Dito.
Comment 3 Rui Matos 2011-07-23 23:20:46 UTC
Created attachment 192546 [details] [review]
prefs: Initialize button_layout struct even on pref string corner cases

We were leaving some members of the button_layout struct uninitialized if the
pref string didn't have at least one colon or if it was an empty string ("").

--

Addressed review comments.
Comment 4 Florian Müllner 2011-07-23 23:23:23 UTC
Review of attachment 192546 [details] [review]:

Looks good.
Comment 5 Rui Matos 2011-07-24 00:50:27 UTC
Attachment 192546 [details] pushed as 779ef58 - prefs: Initialize button_layout struct even on pref string corner cases