From 2b6b23fd8cfae768145e9a9f1f27eb0415e2a617 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Tue, 12 Jun 2018 17:18:58 -0700 Subject: polygon-intersection: Clarify ptr checks for right edges (CID #1160730) The code is checking a variable is non-NULL after it's already been dereferenced in an assert. I'm not certain whether the assert should be conditionalized to only be tested when right != NULL (which would allow edges_end() to still be invoked), or if the function should assert right as non-NULL always. Coverity ID: #1160730 Signed-off-by: Bryce Harrington Reviewed-By: Uli Schlachter --- src/cairo-polygon-intersect.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cairo-polygon-intersect.c b/src/cairo-polygon-intersect.c index 9c1777f4f..001e55ee0 100644 --- a/src/cairo-polygon-intersect.c +++ b/src/cairo-polygon-intersect.c @@ -1107,13 +1107,14 @@ edges_start_or_continue (cairo_bo_edge_t *left, int top, cairo_polygon_t *polygon) { + assert (right != NULL); assert (right->deferred.other == NULL); if (left->deferred.other == right) return; if (left->deferred.other != NULL) { - if (right != NULL && edges_colinear (left->deferred.other, right)) { + if (edges_colinear (left->deferred.other, right)) { cairo_bo_edge_t *old = left->deferred.other; /* continuation on right, extend right to cover both */ @@ -1131,7 +1132,7 @@ edges_start_or_continue (cairo_bo_edge_t *left, edges_end (left, top, polygon); } - if (right != NULL && ! edges_colinear (left, right)) { + if (! edges_colinear (left, right)) { left->deferred.top = top; left->deferred.other = right; } -- cgit v1.2.3