[cairo] infinite loop when CAIRO_FIXED_FRAC_BITS is 8

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Sat Feb 23 20:27:09 PST 2008


Behdad Esfahbod wrote:
> On Thu, 2008-02-14 at 15:15 -0800, Carl Worth wrote:
> > > This breaks the compare function in that it will
> > > both return a<b and b<a for some input slopes a and b.
> > 
> > Right. In my defense, I was aware that this was giving special
> > attention to the order in which the arguments were presented to the
> > function, and I did _some_ analysis that we were calling it
> > consistently, (though my analysis was probably too shallow).
> > 
> > And for what it's worth, we *don't* call qsort with this comparison
> > function.
> 
> We do, by way of _cairo_hull_vertex_compare().  I checked ;).

Just for the record, it turns out that _cairo_hull_vertex_compare() is
never called with directly opposing slopes, so the scenario above
doesn't happen.

To be precise, the corresponding rays all originate from the leftmost
of the topmost points and go towards some other of these points.
As a result, no rays go upwards, and all horizontal rays point to the
right.

Bertram


More information about the cairo mailing list