]> granicus.if.org Git - postgis/commitdiff
Avoid reading into empty ptarray
authorPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 16 Aug 2019 20:59:43 +0000 (20:59 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 16 Aug 2019 20:59:43 +0000 (20:59 +0000)
References #4475

git-svn-id: http://svn.osgeo.org/postgis/branches/2.3@17721 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/g_serialized.c

index 167ed84d3d0fb94af543016a94f741d5f14081d3..ded19115df6c550561b5f8934d28870561be9564 100644 (file)
@@ -706,7 +706,8 @@ static size_t gserialized_from_lwpoly(const LWPOLY *poly, uint8_t *buf)
                        lwerror("Dimensions mismatch in lwpoly");
 
                pasize = pa->npoints * ptsize;
-               memcpy(loc, getPoint_internal(pa, 0), pasize);
+               if ( pasize )
+                       memcpy(loc, getPoint_internal(pa, 0), pasize);
                loc += pasize;
        }
        return (size_t)(loc - buf);