GNOME Bugzilla – Bug 765374
Right-clicking on the location entry causes segfault in non-English locales
Last modified: 2016-08-16 10:48:46 UTC
I know --disable-Werror, but clang caught a real bug this time. In lib/widgets/ephy-location-entry.c, function entry_populate_popup_cb: for (item = children, pos = 0; item != NULL; item = item->next, pos++) { if (g_strcmp0 (gtk_menu_item_get_label (item->data), "_Paste") == 0) { paste_menuitem = item->data; break; } } paste_menuitem will be used uninitialized when there is no item called "_Paste". It is very likely to happen because the string "_Paste" can be translated to other languages. Warning showed by clang: CC libephywidgets_la-ephy-location-entry.lo ephy-location-entry.c:651:34: error: variable 'paste_menuitem' is used uninitialized whenever 'for' loop exits because its condition is false [-Werror,-Wsometimes-uninitialized] for (item = children, pos = 0; item != NULL; item = item->next, pos++) { ^~~~~~~~~~~~ ephy-location-entry.c:660:51: note: uninitialized use occurs here lentry->paste_binding = g_object_bind_property (paste_menuitem, "sensitive", ^~~~~~~~~~~~~~ ephy-location-entry.c:651:34: note: remove the condition if it is always true for (item = children, pos = 0; item != NULL; item = item->next, pos++) { ^~~~~~~~~~~~ ephy-location-entry.c:619:28: note: initialize the variable 'paste_menuitem' to silence this warning GtkWidget *paste_menuitem; ^ = NULL 1 error generated. Makefile:577: recipe for target 'libephywidgets_la-ephy-location-entry.lo' failed
Created attachment 333397 [details] [review] location-entry: Fix position of 'Paste & Go' when non-English locale is used
Review of attachment 333397 [details] [review]: Ooops ;)
Please push this also to the gnome-3-22 branch.
Attachment 333397 [details] pushed as c0bf21a - location-entry: Fix position of 'Paste & Go' when non-English locale is used
Attachment 333397 [details] pushed as d6e95eb - location-entry: Fix position of 'Paste & Go' when non-English locale is used