[postgis-tickets] r17040 - Fix undefined behaviour in raster intersection
Raul
raul at rmr.ninja
Wed Nov 21 06:10:31 PST 2018
Author: algunenano
Date: 2018-11-21 06:10:31 -0800 (Wed, 21 Nov 2018)
New Revision: 17040
Modified:
branches/2.3/NEWS
branches/2.3/raster/rt_core/rt_spatial_relationship.c
Log:
Fix undefined behaviour in raster intersection
References #4249
Modified: branches/2.3/NEWS
===================================================================
--- branches/2.3/NEWS 2018-11-21 14:09:53 UTC (rev 17039)
+++ branches/2.3/NEWS 2018-11-21 14:10:31 UTC (rev 17040)
@@ -17,6 +17,7 @@
- #4223, Fix parallel/near rectangle case in geography (Paul Ramsey)
- #4326, Allocate enough memory in gidx_to_string (Raúl Marín)
- #4247, Avoid undefined behaviour in next_float functions (Raúl Marín)
+ - #4249, Fix undefined behaviour in raster intersection (Raúl Marín)
PostGIS 2.3.7
2018/04/06
Modified: branches/2.3/raster/rt_core/rt_spatial_relationship.c
===================================================================
--- branches/2.3/raster/rt_core/rt_spatial_relationship.c 2018-11-21 14:09:53 UTC (rev 17039)
+++ branches/2.3/raster/rt_core/rt_spatial_relationship.c 2018-11-21 14:10:31 UTC (rev 17040)
@@ -715,12 +715,10 @@
gt2
);
- /* parallel vertically */
- if (FLT_EQ(line1[X2] - line1[X1], 0.) && FLT_EQ(line2[X2] - line2[X1], 0.))
+ /* Parallel lines */
+ if (FLT_EQ(((line1[X2] - line1[X1]) * (line2[Y2] - line2[Y1])),
+ ((line2[X2] - line2[X1]) * (line1[Y2] - line1[Y1]))))
byHeight = 0;
- /* parallel */
- else if (FLT_EQ(((line1[Y2] - line1[Y1]) / (line1[X2] - line1[X1])), ((line2[Y2] - line2[Y1]) / (line2[X2] - line2[X1]))))
- byHeight = 0;
if (byHeight)
dimValue = height2;
More information about the postgis-tickets
mailing list