[postgis-tickets] r17716 - Guard against reading into pointarrays when size of array == 0
Paul Ramsey
pramsey at cleverelephant.ca
Thu Aug 15 10:00:19 PDT 2019
Author: pramsey
Date: 2019-08-15 10:00:19 -0700 (Thu, 15 Aug 2019)
New Revision: 17716
Modified:
trunk/liblwgeom/gserialized1.c
trunk/liblwgeom/gserialized2.c
Log:
Guard against reading into pointarrays when size of array == 0
Modified: trunk/liblwgeom/gserialized1.c
===================================================================
--- trunk/liblwgeom/gserialized1.c 2019-08-14 22:29:10 UTC (rev 17715)
+++ trunk/liblwgeom/gserialized1.c 2019-08-15 17:00:19 UTC (rev 17716)
@@ -861,7 +861,8 @@
lwerror("Dimensions mismatch in lwpoly");
pasize = pa->npoints * ptsize;
- memcpy(loc, getPoint_internal(pa, 0), pasize);
+ if ( pa->npoints > 0 )
+ memcpy(loc, getPoint_internal(pa, 0), pasize);
loc += pasize;
}
return (size_t)(loc - buf);
Modified: trunk/liblwgeom/gserialized2.c
===================================================================
--- trunk/liblwgeom/gserialized2.c 2019-08-14 22:29:10 UTC (rev 17715)
+++ trunk/liblwgeom/gserialized2.c 2019-08-15 17:00:19 UTC (rev 17716)
@@ -919,7 +919,8 @@
lwerror("Dimensions mismatch in lwpoly");
pasize = pa->npoints * ptsize;
- memcpy(loc, getPoint_internal(pa, 0), pasize);
+ if ( pa->npoints > 0 )
+ memcpy(loc, getPoint_internal(pa, 0), pasize);
loc += pasize;
}
return (size_t)(loc - buf);
@@ -1685,4 +1686,4 @@
}
return g_out;
-}
\ No newline at end of file
+}
More information about the postgis-tickets
mailing list