[cairo] [PATCH 03/41] core: _canonical_box() allow NULL box ptr
Uli Schlachter
psychon at znc.in
Fri Dec 11 08:41:55 PST 2015
Am 10.12.2015 um 23:16 schrieb Enrico Weigelt, metux IT consult:
> This function is used by several others which can test pathes
> for certain properties (eg. _cairo_path_fixed_is_box()),
> but expect a pointer to cairo_box_t, which is passed to
> _canonical_box() for filling.
Uhm, sorry, but... what?
I find two callers. _cairo_path_fixed_is_box() and
_cairo_path_fixed_is_stroke_box(). The earlier uses the path's head which is
never NULL, the later dereferences the pointer before calling this function.
So what does this patch fix / help?
> In some cases we dont need that at all and dont wanna have the
> burden of maintaining that return structure, so allow that to
> be skiped by just passing a null pointer.
>
> Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
> ---
> src/cairo-path-fixed.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c
> index ac44bb7..36c332f 100644
> --- a/src/cairo-path-fixed.c
> +++ b/src/cairo-path-fixed.c
> @@ -1203,6 +1203,9 @@ _canonical_box (cairo_box_t *box,
> const cairo_point_t *p1,
> const cairo_point_t *p2)
> {
> + if (box == NULL)
> + return;
> +
> if (p1->x <= p2->x) {
> box->p1.x = p1->x;
> box->p2.x = p2->x;
>
--
A normal person is just someone you don't know well enough yet.
- Nettie Wiebe
More information about the cairo
mailing list