[Tile-serving] [openstreetmap/osm2pgsql] Avoid crashing on out-of-range inputs for int4 columns (#956)

mmd notifications at github.com
Tue Oct 1 17:37:27 UTC 2019


mmd-osm commented on this pull request.



>              m_copy.add_column(from);
         } else if (items == 2) {
-            m_copy.add_column((from + to) / 2);
+            // calculate mean while avoiding overflows
+            int64_t mean = (from / 2) + (to / 2) + ((from % 2 + to % 2) / 2);

How about  `from + ( (to - from) / 2)`, assuming _to_  and _from_ are positive and _from <= to_?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/956#pullrequestreview-295773343
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20191001/2e2556d0/attachment.html>


More information about the Tile-serving mailing list