]> granicus.if.org Git - postgis/commitdiff
geohash_point_as_int: Fix undefined behaviour in shift operation
authorPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 6 Oct 2017 13:21:18 +0000 (13:21 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 6 Oct 2017 13:21:18 +0000 (13:21 +0000)
References #3875

git-svn-id: http://svn.osgeo.org/postgis/branches/2.4@15919 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
liblwgeom/lwalgorithm.c

diff --git a/NEWS b/NEWS
index 0e632ca9c72076e6aa7213bbf672133e29efaed6..e19eaea2f2a251e47be9fb29dbe9dccd070bf3f7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ YYYY/MM/DD
   - #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
index 69b818a7864225b98b703f43b8ab2938ed3aa5b2..27096e80d5f835e7f07a95a587528c46a326bc01 100644 (file)
@@ -666,7 +666,7 @@ unsigned int geohash_point_as_int(POINT2D *pt)
                        mid = (lon[0] + lon[1]) / 2;
                        if (longitude > mid)
                        {
-                               ch |= 0x0001 << bit;
+                               ch |= 0x0001u << bit;
                                lon[0] = mid;
                        }
                        else