[cairo-commit] 2 commits - src/cairo-pdf-surface.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 19 10:48:54 UTC 2021


 src/cairo-pdf-surface.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 941cddfa39584e812d41b16fc80c67a2f9007658
Merge: d72ff7c18 4e2e876be
Author: Heiko Lewin <hlewin at gmx.de>
Date:   Tue Jan 19 10:48:52 2021 +0000

    'Fix' a NULL pointer 'dereference' in cairo-pdf-surface

commit 4e2e876be15b85a3ac94e8343e41d8fb9ae1fdf4
Author: Uli Schlachter <psychon at znc.in>
Date:   Sun Jan 17 20:59:58 2021 +0100

    'Fix' a NULL pointer 'dereference' in cairo-pdf-surface
    
    The expression &image_surface->base basically just casts the
    cairo_image_surface_t* to cairo_surface_t*. However, technically it is a
    NULL pointer dereference and UndefinedBehaviorSanitizer flags it as
    such:
    
    runtime error: member access within null pointer of type 'cairo_image_surface_t' (aka 'struct _cairo_image_surface')
    
    This commit fixes this by adding a NULL check.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 4a7afe960..6da460878 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -943,7 +943,8 @@ _cairo_pdf_surface_clear (cairo_pdf_surface_t *surface)
     _cairo_array_truncate (&surface->knockout_group, 0);
     _cairo_array_truncate (&surface->page_annots, 0);
 
-    cairo_surface_destroy (&surface->thumbnail_image->base);
+    if (surface->thumbnail_image)
+	cairo_surface_destroy (&surface->thumbnail_image->base);
     surface->thumbnail_image = NULL;
 }
 


More information about the cairo-commit mailing list