[cairo] [PATCH 03/41] core: _canonical_box() allow NULL box ptr

Enrico Weigelt, metux IT consult enrico.weigelt at gr13.net
Fri Dec 11 21:05:22 PST 2015


On 11.12.2015 17:41, Uli Schlachter wrote:
> 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?

It's used by one of my subsequent patches:

commit 3546665856413c89c76407015e9ca45f32b22f75
Author: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
Date:   Thu Dec 10 22:05:24 2015 +0100

    drm/i915: fixed test for whether path is a box

    cairo_clip_path_t doesn't have an flags field anymore, so we need
    to fix the test for whether a path is a box.

    Signed-off-by: Enrico Weigelt, metux IT consult
<enrico.weigelt at gr13.net>

diff --git a/src/drm/cairo-drm-i915-surface.c
b/src/drm/cairo-drm-i915-surface.c
index bb463d9..50cd5d8 100644
--- a/src/drm/cairo-drm-i915-surface.c
+++ b/src/drm/cairo-drm-i915-surface.c
@@ -1815,7 +1815,7 @@ _clip_get_solitary_path (const cairo_clip_t *clip)
     cairo_clip_path_t *path = NULL;

     do {
-       if ((iter->flags & CAIRO_CLIP_PATH_IS_BOX) == 0) {
+       if (! _cairo_path_fixed_is_box(iter, NULL)) {
            if (path != NULL)
                return FALSE;

-- 

mit freundlichen Grüßen
--
Enrico Weigelt,
metux IT consulting
+49-151-27565287


More information about the cairo mailing list