]> granicus.if.org Git - postgis/commitdiff
Fix potential access to uninitialized value
authorSandro Santilli <strk@keybit.net>
Thu, 9 May 2013 09:24:13 +0000 (09:24 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 9 May 2013 09:24:13 +0000 (09:24 +0000)
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

index fc01b13cb21c921c43d7e70ee6ffdf66fdffe1aa..8ff92e4cf2a1d5c1afc33f12e81c38bf37a341d2 100644 (file)
@@ -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);