diff options
author | Uli Schlachter <psychon@znc.in> | 2021-01-17 20:59:58 +0100 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2021-01-17 20:59:58 +0100 |
commit | 4e2e876be15b85a3ac94e8343e41d8fb9ae1fdf4 (patch) | |
tree | 6a7f91e396f082dcf4b4a8f07e06d0666f57c52e /src/cairo-pdf-surface.c | |
parent | d72ff7c18aea22fd92238608804782e4841564d2 (diff) |
'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@znc.in>
Diffstat (limited to 'src/cairo-pdf-surface.c')
-rw-r--r-- | src/cairo-pdf-surface.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; } |