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

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


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

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



Modified: branches/2.3/NEWS
===================================================================
--- branches/2.3/NEWS	2017-10-06 13:21:18 UTC (rev 15919)
+++ branches/2.3/NEWS	2017-10-06 13:21:23 UTC (rev 15920)
@@ -28,6 +28,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.3.3

Modified: branches/2.3/liblwgeom/lwalgorithm.c
===================================================================
--- branches/2.3/liblwgeom/lwalgorithm.c	2017-10-06 13:21:18 UTC (rev 15919)
+++ branches/2.3/liblwgeom/lwalgorithm.c	2017-10-06 13:21:23 UTC (rev 15920)
@@ -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