From 0ee2b85a75995cbea578f477a8d66c48f8983474 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Thu, 9 May 2013 09:24:13 +0000 Subject: [PATCH] Fix potential access to uninitialized value It would have happened on malformed COMPOUNDCURVE (unlikely). Hushes compiler warning. git-svn-id: http://svn.osgeo.org/postgis/trunk@11387 b70326c6-7e19-0410-871a-916f4a2858ee --- liblwgeom/lwcompound.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/liblwgeom/lwcompound.c b/liblwgeom/lwcompound.c index fc01b13cb..8ff92e4cf 100644 --- a/liblwgeom/lwcompound.c +++ b/liblwgeom/lwcompound.c @@ -157,11 +157,15 @@ lwcompound_contains_point(const LWCOMPOUND *comp, const POINT2D *pt) { /* Don't check closure while doing p-i-p test */ result = ptarray_contains_point_partial(lwline->points, pt, LW_FALSE, &winding_number); - } + } } - else if ( lwgeom->type == CIRCSTRINGTYPE ) + else { lwcirc = lwgeom_as_lwcircstring(lwgeom); + if ( ! lwcirc ) { + lwerror("Unexpected component of type %s in compound curve", lwtype_name(lwgeom->type)); + return 0; + } if ( comp->ngeoms == 1 ) { return ptarrayarc_contains_point(lwcirc->points, pt); -- 2.50.1