From 79a7354a3a48e90c3bb0edf81d97517ab2d65bd6 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Fri, 6 Oct 2017 13:21:23 +0000 Subject: [PATCH] geohash_point_as_int: Fix undefined behaviour in shift operation References #3875 git-svn-id: http://svn.osgeo.org/postgis/branches/2.3@15920 b70326c6-7e19-0410-871a-916f4a2858ee --- NEWS | 1 + liblwgeom/lwalgorithm.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8ede411f8..a28329eb0 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,7 @@ PostGIS 2.3.4 - #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 diff --git a/liblwgeom/lwalgorithm.c b/liblwgeom/lwalgorithm.c index 726f729f0..19163e310 100644 --- a/liblwgeom/lwalgorithm.c +++ b/liblwgeom/lwalgorithm.c @@ -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 -- 2.49.0