oniksan / godobuf

A Google Protobuf implementation for Godot / GDScript
BSD 3-Clause "New" or "Revised" License
261 stars 36 forks source link

Fix encoding of negative / very large varints #46

Open bschug opened 1 month ago

bschug commented 1 month ago

For very negative numbers (e.g. -9223372036854775800), the encoder would omit the final byte that begins with a zero bit. This would make such protobuf messages unparseable by other protobuf implementations (and also by Godobuf itself, unless it is the last field in a length-delimited record).

This fix makes godobuf behave the same as the official Python implementation.

I don't understand how the test suite works. I can't even run it in Godot 4.3. I have added a set of custom tests for this case. There are instructions on how to run the tests in a README in the test directory.