Skip to content

Negative varints are not handled correctly. #141

@CoolCat467

Description

@CoolCat467

Negative varints are not handled correctly because in Python, numbers are represented with infinite bits instead of 32 or 64, meaning right shift including sign bits does not exist, meaning this implementation only does regular right shift. This causes varints (at the moment) to be able to handle positive integers from 0 to 2 ** 35 - 1 instead of the true range minecraft uses of integers from -2 ** 31 to 2 ** 31 - 1. I predict no one has noticed this before because in this script's usual function, the varint implementation is only used for reading text length, and since text length is never negative it has never been noticed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions