From: Paul Ramsey Date: Fri, 16 Aug 2019 20:59:43 +0000 (+0000) Subject: Avoid reading into empty ptarray X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=edd5134deb592b8c6eeefcbb9e430e6b04728e64;p=postgis Avoid reading into empty ptarray References #4475 git-svn-id: http://svn.osgeo.org/postgis/branches/2.3@17721 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/g_serialized.c b/liblwgeom/g_serialized.c index 167ed84d3..ded19115d 100644 --- a/liblwgeom/g_serialized.c +++ b/liblwgeom/g_serialized.c @@ -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);