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 650110 - [PATCH] Add sanity check in GtkEntryCompletion
[PATCH] Add sanity check in GtkEntryCompletion
Product: gtk+
Classification: Platform
Component: Widget: GtkEntry
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
Depends on:
Reported: 2011-05-13 14:33 UTC by John Lindgren
Modified: 2011-06-01 00:07 UTC
See Also:
GNOME target: ---
GNOME version: ---

Patch (340 bytes, patch)
2011-05-13 14:33 UTC, John Lindgren
accepted-commit_now Details | Review

Description John Lindgren 2011-05-13 14:33:21 UTC
Created attachment 187772 [details] [review]

gtk_entry_completion_complete() calls g_utf8_normalize (gtk_entry_get_text (GTK_ENTRY (completion->priv->entry)), -1, G_NORMALIZE_ALL) without checking that completion->priv->entry is a valid GtkEntry, which can lead to passing a NULL pointer to g_utf8_normalize and a segfault.  Attached patch adds a check for this.

(This is triggered by the current git version of pcmanfm, which probably has a bug; nevertheless, it would be better to handle the condition gracefully.)
Comment 1 John Lindgren 2011-05-13 15:03:42 UTC
Update: This is not caused by a bug in pcmanfm but by GTK bug #650114.
Comment 2 Matthias Clasen 2011-05-16 18:29:56 UTC
Adding a return_if_fail does not make it valid to call completion_complete() on an entry-less completion, but it is fine to add anyway.
Comment 3 Matthias Clasen 2011-05-16 18:30:15 UTC
Review of attachment 187772 [details] [review]:

Please commit