[cairo] Checking matrices for invalid numbers

Chris Wilson chris at chris-wilson.co.uk
Thu Jul 5 05:55:06 PDT 2007

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 ;-).
Chris Wilson
-------------- next part --------------

More information about the cairo mailing list