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 314239 - pangocairo crashes when font cannot be read
pangocairo crashes when font cannot be read
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
1.10.x
Other Linux
: Normal normal
: ---
Assigned To: pango-maint
pango-maint
: 318863 321429 326815 328872 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-08-23 08:45 UTC by Frederic Crozat
Modified: 2006-02-21 11:42 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
patch to not crash (1.35 KB, patch)
2006-01-29 05:43 UTC, Behdad Esfahbod
needs-work Details | Review

Description Frederic Crozat 2005-08-23 08:45:30 UTC
Distribution/Version: Mandriva cooker

to duplicate :
-in a directory used by fontconfig, move one of the font file in /tmp and do ln
-s /tmp/your_font_file.ttf testfont.ttf
-run fc-cache 
-break the symlink (mv /tmp/your_font_file.ttf /tmp/your_font_file_renamed.ttf)
-run gnome-font-property and try to select the font you just renamed

=> crash

backtrace :

Program received signal SIGSEGV, Segmentation fault.

Thread NaN (LWP 19257)

  • #0 get_face_metrics
    at pangofc-font.c line 311
  • #1 pango_fc_font_create_metrics_for_context
    at pangofc-font.c line 409
  • #2 pango_cairo_fc_font_get_metrics
    at pangocairo-fcfont.c line 289
  • #3 pango_font_get_metrics
    at fonts.c line 1212
  • #4 get_first_metrics_foreach
    at pango-context.c line 1273
  • #5 pango_fontset_simple_foreach
    at pango-fontset.c line 394
  • #6 pango_fontset_foreach
    at pango-fontset.c line 100
  • #7 get_base_metrics
    at pango-context.c line 1295
  • #8 pango_context_get_metrics
    at pango-context.c line 1389
  • #9 gtk_entry_size_request
    at gtkentry.c line 1223
  • #10 IA__g_cclosure_marshal_VOID__BOXED
  • #11 g_type_class_meta_marshal
    at gclosure.c line 569
  • #12 IA__g_closure_invoke
    at gclosure.c line 492
  • #13 signal_emit_unlocked_R
    at gsignal.c line 2415
  • #14 IA__g_signal_emit_valist
    at gsignal.c line 2244
  • #15 IA__g_signal_emit_by_name
    at gsignal.c line 2312
  • #16 do_size_request
    at gtksizegroup.c line 592
  • #17 _gtk_size_group_compute_requisition
    at gtksizegroup.c line 788
  • #18 IA__gtk_widget_size_request
    at gtkwidget.c line 2693
  • #19 gtk_font_selection_update_preview
  • #20 gtk_font_selection_load_font
    at gtkfontsel.c line 1090
  • #21 gtk_font_selection_select_best_size
    at gtkfontsel.c line 1008
  • #22 gtk_font_selection_select_style
    at gtkfontsel.c line 930
  • #23 IA__g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 77
  • #24 IA__g_closure_invoke
    at gclosure.c line 492
  • #25 signal_emit_unlocked_R
    at gsignal.c line 2485
  • #26 IA__g_signal_emit_valist
    at gsignal.c line 2244
  • #27 IA__g_signal_emit
    at gsignal.c line 2288
  • #28 _gtk_tree_selection_internal_select_node
  • #29 gtk_tree_view_real_set_cursor
    at gtktreeview.c line 11250
  • #30 IA__gtk_tree_view_set_cursor_on_cell
    at gtktreeview.c line 11378
  • #31 IA__gtk_tree_view_set_cursor
    at gtktreeview.c line 11330
  • #32 set_cursor_to_iter
    at gtkfontsel.c line 648
  • #33 gtk_font_selection_show_available_styles
    at gtkfontsel.c line 879
  • #34 gtk_font_selection_select_font
    at gtkfontsel.c line 703
  • #35 IA__g_cclosure_marshal_VOID__VOID
    at gmarshal.c line 77
  • #36 IA__g_closure_invoke
    at gclosure.c line 492
  • #37 signal_emit_unlocked_R
    at gsignal.c line 2485
  • #38 IA__g_signal_emit_valist
    at gsignal.c line 2244
  • #39 IA__g_signal_emit
    at gsignal.c line 2288
  • #40 _gtk_tree_selection_internal_select_node
    at gtktreeselection.c line 1489
  • #41 gtk_tree_view_real_set_cursor
    at gtktreeview.c line 11250
  • #42 gtk_tree_view_button_press
    at gtktreeview.c line 2400
  • #43 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 83
  • #44 g_type_class_meta_marshal
    at gclosure.c line 569
  • #45 IA__g_closure_invoke
    at gclosure.c line 492
  • #46 signal_emit_unlocked_R
  • #47 IA__g_signal_emit_valist
    at gsignal.c line 2254
  • #48 IA__g_signal_emit
    at gsignal.c line 2288
  • #49 gtk_widget_event_internal
    at gtkwidget.c line 3735
  • #50 IA__gtk_widget_event
    at gtkwidget.c line 3538
  • #51 IA__gtk_propagate_event
    at gtkmain.c line 2157
  • #52 IA__gtk_main_do_event
    at gtkmain.c line 1380
  • #53 gdk_event_dispatch
    at gdkevents-x11.c line 2291
  • #54 g_main_dispatch
    at gmain.c line 1934
  • #55 IA__g_main_context_dispatch
    at gmain.c line 2484
  • #56 g_main_context_iterate
    at gmain.c line 2565
  • #57 IA__g_main_loop_run
    at gmain.c line 2769
  • #58 IA__gtk_main
    at gtkmain.c line 974
  • #59 main
    at main.c line 936
metrics          metrics_by_lang
(gdb) print metrics
$1 = (PangoFontMetrics *) 0x821c078
(gdb) print *metrics
$2 = {ref_count = 1, ascent = 0, descent = 0, approximate_char_width = 0,
  approximate_digit_width = 0, underline_position = 0,
  underline_thickness = 0, strikethrough_position = 0,
  strikethrough_thickness = 0}
(gdb) print face
$3 = 0x0

this crash is a regression compared to pango 1.8.x which was able to get a
fallback font with this particular testcase.
Comment 1 Christian Kirbach 2005-09-10 17:29:55 UTC
Hmmm I cannot confirm on Debian with Gnome 2.11.92
Comment 2 Behdad Esfahbod 2005-11-22 22:05:09 UTC
*** Bug 321429 has been marked as a duplicate of this bug. ***
Comment 3 Matthias Clasen 2006-01-14 15:23:35 UTC
*** Bug 326815 has been marked as a duplicate of this bug. ***
Comment 4 Karsten Bräckelmann 2006-01-29 02:43:22 UTC
*** Bug 328872 has been marked as a duplicate of this bug. ***
Comment 5 Behdad Esfahbod 2006-01-29 05:43:20 UTC
Created attachment 58312 [details] [review]
patch to not crash

This patch crudely changes pango to not crash if a font is not accessible.  Instead, it most probably draws unknown boxes, or uses a fixed font...

This happens because we only create cairo_scaled_font when we need to access the font.  Instead, I guess, we should try to lock/access the scaled_font when choosing the proper font.  This way when a font is not accessible, we will just skip and choose the next font.
Comment 6 Behdad Esfahbod 2006-01-29 05:59:53 UTC
Note that the patch leaks, if it's not obvious...
Comment 7 Behdad Esfahbod 2006-01-29 16:08:29 UTC
This will be fixed in the next release (not the upcoming one), as it's pending on cairo release.
Comment 8 Behdad Esfahbod 2006-02-21 11:38:08 UTC
*** Bug 318863 has been marked as a duplicate of this bug. ***
Comment 9 Behdad Esfahbod 2006-02-21 11:42:06 UTC
Ok, I committed a (rather dirty) hack to fix this problem.  It doesn't crash, just draw boxes instead.  It's just a hack though, and may fail in certain situations.  What I did was checking for NULLs in a few places, but not all places as that would have injured the code too harmfully.  The proper fix has got to wait until 1.13...

Test and attach backtraces if still happens.

2006-02-21  Behdad Esfahbod  <behdad@gnome.org>

        Bug 314239 – pangocairo crashes when font cannot be read

        * pango/pangocairo-fcfont.c, pango/pangocairo-font.c: Hack up to not
        crash if we cannot create cairo_scaled_font_t for PangoFont (font is
        not readable, removed, etc.)