[postgis-tickets] r16142 - Make sure max* slots are filled in when deserializing (closes #3923)

Paul Ramsey pramsey at cleverelephant.ca
Mon Dec 11 06:27:54 PST 2017


Author: pramsey
Date: 2017-12-11 06:27:54 -0800 (Mon, 11 Dec 2017)
New Revision: 16142

Modified:
   trunk/liblwgeom/g_serialized.c
Log:
Make sure max* slots are filled in when deserializing (closes #3923)


Modified: trunk/liblwgeom/g_serialized.c
===================================================================
--- trunk/liblwgeom/g_serialized.c	2017-12-11 14:14:06 UTC (rev 16141)
+++ trunk/liblwgeom/g_serialized.c	2017-12-11 14:27:54 UTC (rev 16142)
@@ -1332,6 +1332,7 @@
 	if ( nrings > 0)
 	{
 		poly->rings = (POINTARRAY**)lwalloc( sizeof(POINTARRAY*) * nrings );
+		poly->maxrings = nrings;
 		ordinate_ptr += nrings * 4; /* Move past all the npoints values. */
 		if ( nrings % 2 ) /* If there is padding, move past that too. */
 			ordinate_ptr += 4;
@@ -1339,6 +1340,7 @@
 	else /* Empty polygon */
 	{
 		poly->rings = NULL;
+		poly->maxrings = 0;
 	}
 
 	for ( i = 0; i < nrings; i++ )
@@ -1447,9 +1449,15 @@
 	data_ptr += 4; /* Skip past the ngeoms. */
 
 	if ( ngeoms > 0 )
+	{
 		collection->geoms = lwalloc(sizeof(LWGEOM*) * ngeoms);
+		collection->maxgeoms = ngeoms;
+	}
 	else
+	{
 		collection->geoms = NULL;
+		collection->maxgeoms = 0;
+	}
 
 	/* Sub-geometries are never de-serialized with boxes (#1254) */
 	FLAGS_SET_BBOX(g_flags, 0);



More information about the postgis-tickets mailing list