[cairo-bugs] [Bug 5734] New: crash with bitmap fonts containing 0x0 glyphs

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Jan 25 23:44:38 PST 2006


Please do not reply to this email: if you want to comment on the bug, go to    
       
the URL shown below and enter yourcomments there.     
   
https://bugs.freedesktop.org/show_bug.cgi?id=5734          
     
           Summary: crash with bitmap fonts containing 0x0 glyphs
           Product: cairo
           Version: 1.1.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: ft font backend
        AssignedTo: otaylor at redhat.com
        ReportedBy: freedesktop at behdad.org
         QAContact: cairo-bugs at cairographics.org


[Originally posted here:
http://lists.freedesktop.org/archives/cairo/2006-January/006207.html]

If a bitmap font has a 0x0 glyphs, the current
cairo-ft-font.c:_get_bitmap_surface returns a NULL surface:

-    if (width * height == 0) {
-       if (own_buffer && bitmap->buffer)
-           free (bitmap->buffer);
-
-       *surface = NULL;
-    } else {

which indeed crashes in the calling function immediately.  So I
first fixed that by fixing the calling function.  This is the
first patch attached.

But seems like (at least) the xlib backend expects non-NULL glyph
surfaces:

(gdb) f 0
#0  0x00477e66 in _cairo_xlib_surface_add_glyph (dpy=0x9ef1878,
scaled_font=0xa1d0238,
    scaled_glyph=0xa1d4518) at cairo-xlib-surface.c:2121
2121        glyph_info.x = -(int) glyph_surface->base.device_x_offset;


So I backed up and removed the special case for 0x0 glyphs.
Everything seems to be fine now.  That's the second patch
attached.  I think it can be committed (with some format change
maybe), as 0x0 glyphs are not common enough to try to save a 0x0
surface for them...

Both patches fix another problem, _render_glyph_bitmap should
check the status returned by _get_bitmap_surface.          
     
     
--           
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email         
     
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


More information about the cairo-bugs mailing list