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

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


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

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



Modified: branches/2.2/NEWS
===================================================================
--- branches/2.2/NEWS	2017-10-06 13:21:23 UTC (rev 15920)
+++ branches/2.2/NEWS	2017-10-06 13:21:38 UTC (rev 15921)
@@ -12,6 +12,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.2.5

Modified: branches/2.2/liblwgeom/lwalgorithm.c
===================================================================
--- branches/2.2/liblwgeom/lwalgorithm.c	2017-10-06 13:21:23 UTC (rev 15920)
+++ branches/2.2/liblwgeom/lwalgorithm.c	2017-10-06 13:21:38 UTC (rev 15921)
@@ -652,7 +652,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