Skip to content

Fix zigzag encoding overflow #31

Description

@anandthakker

The current bit-shifting arithmetic for zigzag encoding:

vt-pbf/index.js

Lines 125 to 127 in ad933a6

function zigzag (num) {
return (num << 1) ^ (num >> 31)
}

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions