[cairo] Bug: Crash in cairo-1.9.8

cu cairouser at yahoo.com
Wed Jun 16 18:31:00 PDT 2010


I think I found it:

In cairo-rectangular-scan-converter.c:337
   if (y == rectangle->bottom_y) {
       height = rectangle->bottom & CAIRO_FIXED_FRAC_MASK;
       if (height == 0)
      continue;
   } else
       height = CAIRO_FIXED_ONE;
   if (y == rectangle->top_y)
       height -= rectangle->top & CAIRO_FIXED_FRAC_MASK;
   height *= rectangle->dir;

The values of height calculated using signed CAIRO_FIXED_FRAC_MASK
differ markedly from those calculated using unsigned original fraction
mask and appear to be incorrect.
Observe this (values Height1 calculated using original definition,
Height2 using updated definition):

Height1 is 0
Height2 is 171008
Height1 is 256
Height2 is -44032
Height1 is 0
Height2 is 171008
Height1 is 256
Height2 is -44032
Height1 is 0
Height2 is 171008
Height1 is 256
Height2 is 256
Height1 is 0
Height2 is 44288
Height1 is 256
Height2 is 256
Height1 is 0
Height2 is 44288
Height1 is 256
Height2 is 256
Height1 is 0
Height2 is 44288
Height1 is 143
Height2 is -177890
Height1 is 205
Height2 is 194253

Values calculated using new definition don't appear very sane to me.
I fixed this for now by adding a second define and using it in this
code. Proper fix would be appreciated.


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
>   

--
cairo mailing list
cairo at cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo


More information about the cairo mailing list