googleapis/python-ndb

Legacy Protobuf Deserialization Code Does Not Handle Negative Numbers

phil-lopreiato opened this issue · 1 comments

Compare the implementation of getVarInt64() here:

    def getVarInt64(self):
        result = self.getVarUint64()
        return result

With the same function in the legacy runtime here

  def getVarInt64(self):
    result = self.getVarUint64()
    if result >= (1L << 63):
      result -= (1L << 64)
    return result

The implementation in this library does not have the code to interpret the MSB as the sign bit and adjust accordingly.

I put up a fix for this in #591