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 662787 - Segfaults when trying to set a large text size
Segfaults when trying to set a large text size
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
2.7.3
Other All
: Normal normal
: 2.8
Assigned To: Jehan
GIMP Bugs
: 85103 696009 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-10-26 17:46 UTC by Laurent Pointecouteau
Modified: 2013-12-08 16:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
return if cairo fails to create a surface (1.45 KB, patch)
2011-10-27 16:28 UTC, Massimo
none Details | Review
same patch, using gimp_message (1.43 KB, patch)
2012-03-03 18:34 UTC, Alexis Wilhelm
none Details | Review
Patch to handle huge font size error. (7.71 KB, patch)
2013-08-30 15:32 UTC, Jehan
none Details | Review
Patch to handle huge font size error. (8.70 KB, patch)
2013-10-24 05:58 UTC, Jehan
none Details | Review

Description Laurent Pointecouteau 2011-10-26 17:46:08 UTC
*Create a new file ;
*Create a new text object, write some text in it ;
*Select the text ;
*Try to change size to a big value (I tried with 400)
*GIMP instantly crashes

Console output :
$ gimp-2.7
This is a development version of GIMP.  Debug messages may appear here.


(script-fu:21417): LibGimpBase-WARNING **: script-fu: gimp_wire_read(): error
Erreur de segmentation
Comment 1 Massimo 2011-10-27 16:28:48 UTC
Created attachment 200115 [details] [review]
return if cairo fails to create a surface

Setting a font size of 2048 px with font Sans and the text
56789012345678901234567890

with the attached patch I see the error message I added, removing
the first 5 the text is rendered normally, without the patch I see
the crash.
Comment 2 Michael Natterer 2011-10-27 19:55:27 UTC
Duplicate of #85103, but leaving open because this is the first reasonable
patch I've seen in 9 years. I think it makes sense to use an error dialog
here via gimp_message().
Comment 3 Michael Natterer 2011-10-27 19:56:50 UTC
*** Bug 85103 has been marked as a duplicate of this bug. ***
Comment 4 Alexis Wilhelm 2012-03-03 18:34:15 UTC
Created attachment 208917 [details] [review]
same patch, using gimp_message
Comment 5 Ari Pollak 2013-03-18 01:26:58 UTC
*** Bug 696009 has been marked as a duplicate of this bug. ***
Comment 6 Jehan 2013-08-30 15:32:31 UTC
Created attachment 253628 [details] [review]
Patch to handle huge font size error.

Hi,

I could not reproduce the original crash by following the reproduction steps.
But when testing, I encountered another issue with pango though, which has a font-size limit (which I also try to improve in Bug 707131).
When I reach it (with value above 2000 pixels font-size basically), it would output a warning: "Value of 'size' attribute on <span> tag on line %d could not be parsed; should be an integer less than %d, or a string such as 'small', not '%s'" and fail to render.

The attached patch refreshes the above patches (which were broken against current master code) and adds handling for the pango size error by outputting a nice error dialog telling the user why the rendering cannot be done.
Comment 7 Michael Natterer 2013-09-24 00:25:57 UTC
Very nice. The usual pattern would however be to append a GError **error
parameter and return an error instead of passing in a Gimp. Or did I already
say that on IRC?
Comment 8 Jehan 2013-09-24 01:25:05 UTC
Mitch: no you didn't, or I was not there when you did. ;-)

Ok I'll have a look back at my patch and update it then. May take a few days. This patch is kind of old so I don't remember at old the specifics. :p
Comment 9 Jehan 2013-10-24 05:58:32 UTC
Created attachment 257985 [details] [review]
Patch to handle huge font size error.

Hey Mitch,

attached the new patch which passes GError** around. :-)
Comment 10 Michael Natterer 2013-10-24 06:22:28 UTC
Excellent, one small glitch would be that in gimp_text_layout_set_markup()
you'd rather use a local error instead of poking around in the
error that got passed in. Fix that if you feel like it and push :)
Comment 11 Jehan 2013-10-24 07:30:03 UTC
I now free the glib error returned by pango and create a new locale GIMP_ERROR instead. :-)
Pushed on master and soon on gimp-2-8.

commit 2aabbbd9c733a9078d08b15bedef6e9adae1031f
Author: Jehan <jehan@girinstud.io>
Date:   Sat Aug 31 03:16:44 2013 +1200

    Bug 662787 - Segfaults when trying to set a large text size
    
    If a font size is too big for cairo or pango to deal with, nicely back
    up from rendering and alert the user via an error dialog.