Two fixes to `render_expired`'s "already requested" tracking:

- **Heap over-read**: the bitmap was sized in bytes but read as `unsigned 
int`s, so lookups read past the end at low zooms (plus a `1 << 31` 
signed-overflow UB).
- **Memory use**: the per-zoom bitmaps reserved one bit for every possible 
metatile, about 2 GB of address space with `--max-zoom 20`. They're replaced by 
a hash set of the tiles actually seen. For 200k random z20 tiles, peak RSS 
drops from 1.27 GB to 103 MB; `--verbose` output is byte-for-byte identical.

Independent of the other PRs in this series; it applies to `master` on its own 
and merges cleanly with each of them in any order.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01YForD7qSL9LT6FhMuAoKPV

You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/mod_tile/pull/508

-- Commit Summary --

  * render_expired: fix heap over-read of the requested-tile bitmap
  * render_expired: track requested metatiles in a hash set

-- File Changes --

    M src/render_expired.c (52)

-- Patch Links --

https://github.com/openstreetmap/mod_tile/pull/508.patch
https://github.com/openstreetmap/mod_tile/pull/508.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/mod_tile/pull/508
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/mod_tile/pull/[email protected]>
_______________________________________________
Tile-serving mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/tile-serving

Reply via email to