Bug 7437 - fbCompositeSolidMask_nx8x8888 broken for very small masks
Summary: fbCompositeSolidMask_nx8x8888 broken for very small masks
Status: RESOLVED INVALID
Alias: None
Product: cairo
Classification: Unclassified
Component: image backend (show other bugs)
Version: 1.2.0
Hardware: PowerPC Mac OS X (All)
: high normal
Assignee: Carl Worth
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-06 01:11 UTC by Dave Vasilevsky
Modified: 2008-09-28 13:37 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Test case (1.08 KB, application/octet-stream)
2006-07-06 01:11 UTC, Dave Vasilevsky
Details

Description Dave Vasilevsky 2006-07-06 01:11:04 UTC
The mask stride is calculated with:

  fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1);

For the purposes of the stride only, this is equivalent to:

  maskStride = pMask->pixels->stride / sizeof(FbBits) * sizeof(FbBits) / sizeof(CARD8);

But performing an integer-divide and then a multiply can lose data!


For example, consider when pMask->pixels->stride == 2. Since sizeof(FbBits) == 4, the division yields 
zero, and maskStride ends up zero--which is clearly incorrect.

I am including a test case. Compile test.c against cairo, and observe that although the mask used is a 
checkerboard pattern, the result is vertical lines. Because the mask stride is zero, each row ends up 
using the same mask.


It is quite possible (likely?) that many places where fbGetDrawable is used have problems similar to this.
Comment 1 Dave Vasilevsky 2006-07-06 01:11:45 UTC
Created attachment 6133 [details]
Test case
Comment 2 Chris Wilson 2008-09-28 13:37:19 UTC
In order to use cairo/pixman you need to supply data that is aligned to uint32_t boundaries - applications can use cairo_format_stride_for_width() to compute the appropriate stride for their image data.


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.