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 738015 - get_pretty_name can not handle empty strings
get_pretty_name can not handle empty strings
Status: RESOLVED FIXED
Product: gnome-documents
Classification: Core
Component: general
3.14.x
Other All
: Normal normal
: ---
Assigned To: GNOME documents maintainer(s)
GNOME documents maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-10-06 16:57 UTC by Debarshi Ray
Modified: 2014-10-07 09:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
places-bookmarks: Don't crash if page has no text (1.30 KB, patch)
2014-10-06 17:04 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2014-10-06 16:57:21 UTC
If the input to get_pretty_name is '', then it ends up executing the following statement with i = -1, which leads to a crash:
    basename = g_utf8_substring (trimmed, 0, i);

This is because both last_sentence and last_word are set to -1.

This can happen if ev_document_text_get_text returns an empty string for a bookmarked page. eg., the first page in the attached PDF.
Comment 2 Debarshi Ray 2014-10-06 17:04:07 UTC
Created attachment 287865 [details] [review]
places-bookmarks: Don't crash if page has no text
Comment 3 Cosimo Cecchi 2014-10-06 17:09:14 UTC
Review of attachment 287865 [details] [review]:

Thanks!
Comment 4 Debarshi Ray 2014-10-07 09:32:15 UTC
Comment on attachment 287865 [details] [review]
places-bookmarks: Don't crash if page has no text

Thanks for the quick review, Cosimo!