[postgis-tickets] [PostGIS] #4059: Please avoid use of variable length array
PostGIS
trac at osgeo.org
Wed Mar 28 01:22:57 PDT 2018
#4059: Please avoid use of variable length array
---------------------+---------------------------
Reporter: vmo | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.5.0
Component: postgis | Version: trunk
Keywords: |
---------------------+---------------------------
While trying to compile with Microsoft Visual, I came across this use of
variable length array (in geography_centroid.c) because the compiler
doesn't support those.
{{{
case MULTIPOINTTYPE:
{
LWMPOINT* mpoints = lwgeom_as_lwmpoint(lwgeom);
/* average between all points */
uint32_t size = mpoints->ngeoms;
POINT3DM points[size];
uint32_t i;
for (i = 0; i < size; i++) {
points[i].x = lwpoint_get_x(mpoints->geoms[i]);
points[i].y = lwpoint_get_y(mpoints->geoms[i]);
points[i].m = 1;
}
lwpoint_out = geography_centroid_from_wpoints(srid,
points, size);
break;
}
}}}
This is a tad dangerous IMHO with geometries, since they can be
arbitrarily large (let's take the geographic centroid of a pointcloud ;)
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4059>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list