[postgis-tickets] r15919 - geohash_point_as_int: Fix undefined behaviour in shift operation

Paul Ramsey pramsey at cleverelephant.ca
Fri Oct 6 06:21:18 PDT 2017


Author: pramsey
Date: 2017-10-06 06:21:18 -0700 (Fri, 06 Oct 2017)
New Revision: 15919

Modified:
   branches/2.4/NEWS
   branches/2.4/liblwgeom/lwalgorithm.c
Log:
geohash_point_as_int: Fix undefined behaviour in shift operation
References #3875



Modified: branches/2.4/NEWS
===================================================================
--- branches/2.4/NEWS	2017-10-06 13:20:05 UTC (rev 15918)
+++ branches/2.4/NEWS	2017-10-06 13:21:18 UTC (rev 15919)
@@ -9,6 +9,7 @@
   - #3879, Division by zero in some arc cases
   - #3878, Single defn of signum in header
   - #3880, Undefined behaviour in TYPMOD_GET_SRID
+  - #3875, Fix undefined behaviour in shift operation
 
 
 PostGIS 2.4.0

Modified: branches/2.4/liblwgeom/lwalgorithm.c
===================================================================
--- branches/2.4/liblwgeom/lwalgorithm.c	2017-10-06 13:20:05 UTC (rev 15918)
+++ branches/2.4/liblwgeom/lwalgorithm.c	2017-10-06 13:21:18 UTC (rev 15919)
@@ -666,7 +666,7 @@
 			mid = (lon[0] + lon[1]) / 2;
 			if (longitude > mid)
 			{
-				ch |= 0x0001 << bit;
+				ch |= 0x0001u << bit;
 				lon[0] = mid;
 			}
 			else



More information about the postgis-tickets mailing list