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 765374 - Right-clicking on the location entry causes segfault in non-English locales
Right-clicking on the location entry causes segfault in non-English locales
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Controls
git master
Other FreeBSD
: Normal critical
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-04-21 13:49 UTC by Ting-Wei Lan
Modified: 2016-08-16 10:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
location-entry: Fix position of 'Paste & Go' when non-English locale is used (1.06 KB, patch)
2016-08-16 09:05 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2016-04-21 13:49:03 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
Comment 1 Ting-Wei Lan 2016-08-16 09:05:02 UTC
Created attachment 333397 [details] [review]
location-entry: Fix position of 'Paste & Go' when non-English locale is used
Comment 2 Michael Catanzaro 2016-08-16 10:34:51 UTC
Review of attachment 333397 [details] [review]:

Ooops ;)
Comment 3 Michael Catanzaro 2016-08-16 10:35:09 UTC
Please push this also to the gnome-3-22 branch.
Comment 4 Ting-Wei Lan 2016-08-16 10:45:54 UTC
Attachment 333397 [details] pushed as c0bf21a - location-entry: Fix position of 'Paste & Go' when non-English locale is used
Comment 5 Ting-Wei Lan 2016-08-16 10:48:23 UTC
Attachment 333397 [details] pushed as d6e95eb - location-entry: Fix position of 'Paste & Go' when non-English locale is used
Comment 6 Ting-Wei Lan 2016-08-16 10:48:46 UTC
Attachment 333397 [details] pushed as d6e95eb - location-entry: Fix position of 'Paste & Go' when non-English locale is used