[cairo] Bug: Crash in cairo-1.9.8

cu cairouser at yahoo.com
Wed Jun 16 18:14:13 PDT 2010


After quite a bit of experimentation, I think that the original fix
causes something inside either cairo or pixman to overflow allocated
memory.

I'll keep digging, but so far for the lack of working valgrind for MacOS
10.6 I can't pinpoint what that is and can't construct a small enough
test case (this seems to hinge on some timing and the fact that some
surfaces are drawn in background threads, perhaps). However, removing
the fix solves the memory corruption issue, so the causal connection is
there.

The following fix solves (at least masks?) the original problem
(unsigned vs. signed) and does not cause memory corruption:

static inline int
_cairo_fixed_integer_round_down (cairo_fixed_t f)
{
    return (f + (cairo_fixed_t)CAIRO_FIXED_FRAC_MASK/2) >>
CAIRO_FIXED_FRAC_BITS;
}

And leaving the CAIRO_FIXED_FRAC_MASK defined as unsigned.

It would be very nice if someone with better understanding of image
surface and it's memory use could look into this since it is likely that
the issue exists otherwise. At a very least it would be good to have
this patch applied instead of the other one to make 1.9.8 usable on Mac
out of the box.


Andrea Canciani wrote:
> On Wed, Jun 16, 2010 at 10:12 PM, cu <cairouser at yahoo.com> wrote:
>   
>> I can look into differences of converter macros between 1.9.6 and 1.9.8
>> but would someone please confirm first that the x = -128 input is
>> actually meaningful and that it is meant to be converted to 0 (as it did
>> with 1.9.6)?
>>
>> I do know that MacOS compiler is "shift sensitive" (I've hit a few other
>> places where shifting values did things differently from
>> Linux/Windows/anywhere else) and may need to be handled with some care.
>>     
> It was actually doing the right thing.
> Could you please try git master or 1.9.8 patched with
> http://cgit.freedesktop.org/cairo/commit/?id=3cd07559328b60e3da85debb805cb4a3fc4abc22
> ?
> Thank you for your bug report
> Andrea Canciani
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>   



More information about the cairo mailing list