Opened 3 years ago
Closed 3 years ago
#4953 closed defect (fixed)
Small fix to function edge_distance_to_point
Reported by: | ezimanyi | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.1.3 |
Component: | postgis | Version: | 2.5.x -- EOL |
Keywords: | geodetic | Cc: |
Description
The third parameter closest can be NULL. This is tested at the end of the function but not at the beginning. The code below is extracted from PostGIS 3.1.2.
double edge_distance_to_point(const GEOGRAPHIC_EDGE *e, const GEOGRAPHIC_POINT *gp, GEOGRAPHIC_POINT *closest) { double d1 = 1000000000.0, d2, d3, d_nearest; POINT3D n, p, k; GEOGRAPHIC_POINT gk, g_nearest; /* Zero length edge, */ if ( geographic_point_equals(&(e->start), &(e->end)) ) { if (closest) <----------------- Missing test *closest = e->start; return sphere_distance(&(e->start), gp); } [...] if (closest) *closest = g_nearest; return d_nearest; }
Regards
Esteban
Note:
See TracTickets
for help on using tickets.
In d3f1c2b5/git: