[cairo] [PATCH] Avoid potential crash when subsurface's size is less than 0.

Chris Wilson chris at chris-wilson.co.uk
Tue Mar 13 04:24:18 PDT 2012

On Tue, 13 Mar 2012 10:00:37 +0800, Chuanbo Weng <strgnm at gmail.com> wrote:
> When cairo_surface_create_for_rectangle() get non-integer parameters,
> the subsurface's size may be negative(e.g x = 0.2, width = 0.7, the
> final width will be -1). It may cause crash somewhere when use this
> subsurface. Although fractional surface is ill-defined, we should avoid
> crash when pass non-integer parameter.

I modified the patch slightly to reject an invalid negative width/height
passed in by the user as well as fixing up the case where we compute
the negative surface size.


Chris Wilson, Intel Open Source Technology Centre

More information about the cairo mailing list