[cairo] Checking matrices for invalid numbers

Behdad Esfahbod behdad at behdad.org
Thu Jul 5 12:04:54 PDT 2007


On Thu, 2007-07-05 at 08:55 -0400, Chris Wilson wrote:
> Recently it was pointed out on IRC that the CTM could become corrupt
> over time - and even worse, Cairo would not notice!
> 
> Attached is a proposed change to include an isfinite() check on the
> determinant. Sadly isfinite() is only provided by the C99 spec and
> requires -std=c99 for gcc (actually -std=gnu99 otherwise gcc stops
> compiling Cairo - not sure why). Is this acceptable or would a more
> portable method, such as:
> if (! ((det * det) > 0)) return CAIRO_STATUS_INVALID_MATRIX;
> be preferred (better suggestions welcome ;-).

I prefer the more portable approach.

behdad


> --
> Chris Wilson
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list