[Tile-serving] [openstreetmap/osm2pgsql] valgrind: get_sparse - move depends on uninitialised value (#1442)

mmd notifications at github.com
Wed Mar 31 17:15:19 UTC 2021



Since @joto asked me to provide a fix, rather than just reporting random valgrind issues, my proposal would be an additional check in get_sparse to check for sizeSparseTuples == 0. This eliminates the valgrind error, while test cases are still passing.

Does this make sense?

```
osmium::Location node_ram_cache::get_sparse(osmid_t id) const
{
    if (sizeSparseTuples == 0) {
      return osmium::Location{};
    }

    int64_t pivotPos = sizeSparseTuples >> 1;
    int64_t minPos = 0;
    int64_t maxPos = sizeSparseTuples;

    while (minPos <= maxPos) {
```

-- 
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/issues/1442#issuecomment-811263736
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20210331/5939fe8c/attachment.htm>


More information about the Tile-serving mailing list