From 7a15ba7284b07d87bd9901e933552cd3802bb30f Mon Sep 17 00:00:00 2001 From: William Bader Date: Mon, 21 Apr 2025 19:47:55 +0200 Subject: [PATCH] Fix NULL dereference in active_edges_to_traps() provoked by https://gitlab.freedesktop.org/poppler/poppler/-/issues/1579 --- src/cairo-bentley-ottmann-rectangular.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cairo-bentley-ottmann-rectangular.c b/src/cairo-bentley-ottmann-rectangular.c index 65f95d797..5bca289cd 100644 --- a/src/cairo-bentley-ottmann-rectangular.c +++ b/src/cairo-bentley-ottmann-rectangular.c @@ -468,6 +468,9 @@ active_edges_to_traps (sweep_line_t *sweep) edge_t *left, *right; int winding; + if (unlikely (pos == NULL)) + break; + left = pos; winding = left->dir; @@ -503,6 +506,8 @@ active_edges_to_traps (sweep_line_t *sweep) * boxes. */ winding += right->dir; + if (unlikely (right->next == NULL)) + break; if (winding == 0 && right->x != right->next->x) break;