Bug 4339 - xlib backend crash when using large font size
Summary: xlib backend crash when using large font size
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: xlib backend (show other bugs)
Version: 1.0.0
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
: 13266 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-09-02 02:18 UTC by Steve Chaplin
Modified: 2008-05-23 16:12 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
a test case (3.31 KB, text/plain)
2005-09-02 02:20 UTC, Steve Chaplin
Details

Description Steve Chaplin 2005-09-02 02:18:56 UTC
Using cvs.
Test case attached.

the draw() function sets a 0.0-1.0, 0.0-1.0 user-space, selects a font_face and
forgets to set the font_size (I guess it defaults to a value like 10?).
The png backend works OK, draws part of the large font and clips the rest.
The xlib backend crashes.
Comment 1 Steve Chaplin 2005-09-02 02:20:57 UTC
Created attachment 3152 [details]
a test case
Comment 2 Behdad Esfahbod 2006-06-14 10:39:36 UTC
Reproduced.
Comment 3 Chris Wilson 2008-04-04 09:11:25 UTC
*** Bug 13266 has been marked as a duplicate of this bug. ***
Comment 4 Chris Wilson 2008-04-04 10:13:49 UTC
commit 2c8ead12a64d0deff4dc9e32c60f2815fe7c4a63
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Apr 4 17:46:54 2008 +0100

    [xlib] Avoiding sending glyphs > XMaxRequestSize.

    XRenderAddGlyph() does not split its image data across multiple requests
    and so the glyph surface must be smaller than XMaxRequestSize or else
    the server will disconnect the client, causing "Fatal IO error 104".
    As this will require an extension to the XRender spec, we can work
    around the issue by using our fallbacks if we detect that the glyph will
    be too large for a single request.
    
    See bugs https://bugs.freedesktop.org/show_bug.cgi?id=4339 and
    http://bugs.freedesktop.org/show_bug.cgi?id=13266 for examples.
Comment 5 Behdad Esfahbod 2008-05-23 14:58:47 UTC
FWIW, I looked into this again, and I can reproduce it only if the glyph is larger than 16M.  That's 256 times the max request size.  Hardcoding it in there.  One should track this down into xrender implementation and fix it there.
Comment 6 Behdad Esfahbod 2008-05-23 15:30:32 UTC
Xrender uses BigRequest extension for AddGlyphs, if available.  Seems like we are hitting the max bigreq size.  Trying to find API for that.
Comment 7 Behdad Esfahbod 2008-05-23 16:12:50 UTC
commit 1e602b82a19e093309c6c121d1af650dd8b3ec1c
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Fri May 23 19:04:13 2008 -0400

    [cairo-xlib] Fix max-request size calculations
    
    First, XMaxRequestSize returns number of 4-byte words.  So multiply by 4 is
    needed in all uses.  Next, XRenderAddGlyphs uses BIG-REQUEST extension if
    available, so when checking for glyph size overflow, we should use
    XExtendedMaxRequestSize() first.
    
    Also use the right format when calculating glyph size.
    
    See bug #4339 for history.



Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.