[postgis-tickets] r17019 - Allocate enough memory in gidx_to_string
Raul
raul at rmr.ninja
Thu Nov 15 01:08:17 PST 2018
Author: algunenano
Date: 2018-11-15 01:08:17 -0800 (Thu, 15 Nov 2018)
New Revision: 17019
Modified:
trunk/NEWS
trunk/libpgcommon/gserialized_gist.c
Log:
Allocate enough memory in gidx_to_string
Close #4236
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2018-11-15 09:06:54 UTC (rev 17018)
+++ trunk/NEWS 2018-11-15 09:08:17 UTC (rev 17019)
@@ -36,6 +36,7 @@
- #4155, Support for GEOMETRYCOLLECTION, POLYGON, TIN, TRIANGLE in
ST_LocateBetween and ST_LocateBetweenElevations (Darafei Praliaskouski)
- #2767, Documentation for AddRasterConstraint optional parameters (Sunveer Singh)
+ - #4326, Allocate enough memory in gidx_to_string (Raúl Marín)
PostGIS 2.5.0
2018/09/23
Modified: trunk/libpgcommon/gserialized_gist.c
===================================================================
--- trunk/libpgcommon/gserialized_gist.c 2018-11-15 09:06:54 UTC (rev 17018)
+++ trunk/libpgcommon/gserialized_gist.c 2018-11-15 09:08:17 UTC (rev 17019)
@@ -35,8 +35,13 @@
if ( a == NULL )
return pstrdup("<NULLPTR>");
-
- str = (char*)palloc(128); /* 15*2*4+8==128 */
+ /* 4 (GIDX_MAX_DIM) *
+ * 2 (MAX & MIN) *
+ * 20 (Max representation (e.g. -3.40282346639e+38) [19] + space)
+ * = 4*2*20 = 160
+ * + 9 [ 'GIDX(' = 5, ',' = 1, ' )' = 2 + '\0' = 1]
+ */
+ str = (char *)palloc(169);
rv = str;
ndims = GIDX_NDIMS(a);
More information about the postgis-tickets
mailing list