Fix zigzag encoding overflow
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 206
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
The current bit-shifting arithmetic for zigzag encoding:
https://github.com/mapbox/vt-pbf/blob/ad933a6492425a0d2eb56744fa1623345dad4cc9/index.js#L125-L127
overflows for `2^31 - 1`, because JavaScript bit-shifting yields signed 32-bit integers: https://www.ecma-international.org/ecma-262/5.1/#sec-11.7.1
This is unlikely to matter in practice, given that tile extents are typically 4096 or 8192
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in index.js at lines 125-127 and inspect the bit-shifting arithmetic used for zigzag encoding. Reproduce the case for 2^31 - 1, then verify that the encoding no longer overflows while preserving the existing behavior for typical tile extents.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100