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 755215 - Crash when renaming a sidebar’s folder (function that shouldn’t be there)
Crash when renaming a sidebar’s folder (function that shouldn’t be there)
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
3.17.x
Other Linux
: Normal critical
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2015-09-18 11:52 UTC by Arnaud B.
Modified: 2015-09-25 14:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot. (134.92 KB, image/png)
2015-09-18 11:52 UTC, Arnaud B.
  Details
gtkplacessidebar: avoid to use a freed string (1.65 KB, patch)
2015-09-24 14:14 UTC, Carlos Soriano
committed Details | Review
gtkbookmarksmanager: don't allow non valid utf8 in bookmarks (975 bytes, patch)
2015-09-24 14:14 UTC, Carlos Soriano
none Details | Review
gtkbookmarksmanager: don't allow non valid utf8 in bookmarks (957 bytes, patch)
2015-09-25 11:58 UTC, Carlos Soriano
committed Details | Review

Description Arnaud B. 2015-09-18 11:52:36 UTC
Created attachment 311630 [details]
Screenshot.

The FileChooser dialog doesn’t usually (and shouldn’t) permit to rename folders or files, as it’s a selection dialog. But, when right-clicking in the GtkPlacesSidebar (on “Documents”/“Images”/“Music”…, hopefully not “Home Folder” nor “Trash”), you are able to rename some of the main folders, and that makes here the application crash (even if the renaming happens); this function should not be accessible here.
Comment 1 Matthias Clasen 2015-09-23 17:35:35 UTC
have a stacktrace ?
Comment 2 Matthias Clasen 2015-09-23 17:40:26 UTC
we allow renaming on bookmarks and xdg folders. but it only seems to be implemented for bookmarks. nothing should happen for xdg folders
Comment 3 Matthias Clasen 2015-09-24 13:03:48 UTC
"nothing should happen for xdg folders"

What I meant to say here is: the code looks like nothing will happen, so I'm surprised by the crash.

We should either implement the renaming for xdg-folders (at least nautilus might want that), or make the rename item sensitive only for bookmarks.
Comment 4 Carlos Soriano 2015-09-24 14:14:11 UTC
Created attachment 312060 [details] [review]
gtkplacessidebar: avoid to use a freed string

The string we were using is the representation of the internal text
in the popover entry. However that can be freed before setting the
bookmark label, if i.e. the row is destroyed and therefore the popover
as well.
To avoid that, duplicate the label in a local variable.

One of the consequences is that for those people using development version
we migth screwed its bookmarks file, since the bookmark manager wrote
garbage from the already freed label.
Comment 5 Carlos Soriano 2015-09-24 14:14:48 UTC
Created attachment 312061 [details] [review]
gtkbookmarksmanager: don't allow non valid utf8 in bookmarks

In case some client send to us a non valid utf8 string, don't screw up
the bookmarks file and just return.
Comment 6 Matthias Clasen 2015-09-25 10:18:21 UTC
Review of attachment 312060 [details] [review]:

ok
Comment 7 Matthias Clasen 2015-09-25 10:21:06 UTC
Review of attachment 312061 [details] [review]:

hmm, we don't usually do utf8 validation on parameters, with the understanding that its the callers responsibility to ensure that they pass valid strings. And we do validate the bookmarks already when we are loading the file
Comment 8 Carlos Soriano 2015-09-25 11:58:59 UTC
Created attachment 312132 [details] [review]
gtkbookmarksmanager: don't allow non valid utf8 in bookmarks

In case some client send to us a non valid utf8 string, don't screw up
the bookmarks file and just return.
Comment 9 Matthias Clasen 2015-09-25 12:57:38 UTC
Review of attachment 312132 [details] [review]:

ok
Comment 10 Carlos Soriano 2015-09-25 14:11:20 UTC
Thanks for review Mathias

Attachment 312060 [details] pushed as ecc698a - gtkplacessidebar: avoid to use a freed string
Attachment 312132 [details] pushed as 6e83c3b - gtkbookmarksmanager: don't allow non valid utf8 in bookmarks