From 6678a517f8fc839dbe17c0846c5368c4327aef5b Mon Sep 17 00:00:00 2001 From: Oneric Date: Mon, 11 Apr 2022 21:25:04 +0200 Subject: rasterizer: fix pointer arithmetic in assert path->points can be NULL and any pointer arithmetic on NULL, even NULL + 0, is undefined behaviour. The rest of the function should be safe with NULL. Found by AFL++ and UBSAN. --- libass/ass_rasterizer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libass/ass_rasterizer.c b/libass/ass_rasterizer.c index 0ae9e56..36d7883 100644 --- a/libass/ass_rasterizer.c +++ b/libass/ass_rasterizer.c @@ -314,7 +314,7 @@ bool rasterizer_set_outline(RasterizerData *rst, return false; } } - assert(start == cur && cur == path->points + path->n_points); + assert(start == cur && (!cur || cur == path->points + path->n_points)); for (size_t k = rst->n_first; k < rst->size[0]; k++) { struct segment *line = &rst->linebuf[0][k]; -- cgit v1.2.3