Bug 3798 - 64bit fix for xlib _get_image_surface
Summary: 64bit fix for xlib _get_image_surface
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: xlib backend (show other bugs)
Version: 0.9.3
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-16 22:49 UTC by Martin Kretzschmar
Modified: 2005-08-22 00:14 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Martin Kretzschmar 2005-07-16 22:49:28 UTC
The part that computes the pixel format is not 64bit safe.

Without the attached patch, the value of masks.alpha_mask for an ARGB32 surface
is computed as 0xFFFFFFFFFF000000 instead of the correct 0xFF000000. The patch
adds explicit casts to prevent this sign extension.

Without the patch all test cases using the xlib backend fail because the
png-writing code doesn't recognize the image format.
Comment 1 Martin Kretzschmar 2005-07-16 22:50:37 UTC
Created attachment 3096 [details]
x.org.0.log with i810 driver, 6.8.99.15
Comment 2 Owen Taylor 2005-07-29 03:05:15 UTC
2005-07-16  Owen Taylor  <otaylor@redhat.com>

        Patch from Martin Kretzschmar <martink@gnome.org>, #3798

        * src/cairo-xlib-surface.c (_get_image_surface): prevent
        sign-extension of masks.*_mask on 64bit architectures.

        * src/cairo-xcb-surface.c (_get_image_surface): ditto.

I didn't make the 0xffffffff => 0xffffffffUL changes because:

 - A long constant wasn't actually needed
 - We don't mark them elsewhere
 - The code might (or might not) be a tiny bit more compact with
   a shorter constant

Please reopen if I'm missing something.
Comment 3 Carl Worth 2005-08-22 17:14:28 UTC
Move bugs against "cvs" version to "0.9.3" so we can remove the "cvs" version.


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.