[postgis-tickets] r17043 - Fix undefined behaviour in raster intersection
Raul
raul at rmr.ninja
Wed Nov 21 06:14:01 PST 2018
Author: algunenano
Date: 2018-11-21 06:14:01 -0800 (Wed, 21 Nov 2018)
New Revision: 17043
Modified:
trunk/NEWS
trunk/raster/rt_core/rt_spatial_relationship.c
Log:
Fix undefined behaviour in raster intersection
Closes #4249
Closes https://github.com/postgis/postgis/pull/340
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2018-11-21 14:13:03 UTC (rev 17042)
+++ trunk/NEWS 2018-11-21 14:14:01 UTC (rev 17043)
@@ -40,6 +40,7 @@
- #4190, Avoid undefined behaviour in gserialized_estimate (Raúl Marín)
- #4233, Fix undefined behaviour in gserialized_spgist_picksplit_nd (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.5.0
2018/09/23
Modified: trunk/raster/rt_core/rt_spatial_relationship.c
===================================================================
--- trunk/raster/rt_core/rt_spatial_relationship.c 2018-11-21 14:13:03 UTC (rev 17042)
+++ trunk/raster/rt_core/rt_spatial_relationship.c 2018-11-21 14:14:01 UTC (rev 17043)
@@ -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