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

Paul Ramsey pramsey at cleverelephant.ca
Fri Oct 6 06:20:05 PDT 2017


Author: pramsey
Date: 2017-10-06 06:20:05 -0700 (Fri, 06 Oct 2017)
New Revision: 15918

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



Modified: trunk/liblwgeom/lwalgorithm.c
===================================================================
--- trunk/liblwgeom/lwalgorithm.c	2017-10-06 13:18:01 UTC (rev 15917)
+++ trunk/liblwgeom/lwalgorithm.c	2017-10-06 13:20:05 UTC (rev 15918)
@@ -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