Repository navigation
Fix int64_t overflow in signed varint decoder - #30
Conversation
Problem: fstGetSVarint64() accumulates the varint in an int64_t, so a long enough varint shifts past the width of the type, which is undefined behaviour and is reported by UBSan. Solution: accumulate in a uint64_t, dropping the bits that do not fit.
|
CI failed on Windows, but it was in a pre-existing test. I think it is unrelated to the changes here and is probably due to some race/timing issue. An AI review pointed out that I will create another branch with a fix for that. Rerunning the CI here should make it pass. Edit: actually |
|
OK, #30 passes checks now, thanks. |
Problem: fstGetSVarint64() accumulates the varint in an int64_t, so a long enough varint shifts past the width of the type, which is undefined behaviour and is reported by UBSan.
Solution: accumulate in a uint64_t, dropping the bits that do not fit.