Hacker News new | past | comments | ask | show | jobs | submit login

Why does the fix work like that - only checking for this one scenario when you decrement by type max? [1]

In Solidity, where it's a serious security risk, before the language performed overflow checks itself, library authors would perform the arithmetic operation and then e.g. check if the result is larger than the original value in the case of a positive subtrahend [2].

[1] https://github.com/apache/kvrocks/pull/1581/commits/dc5140dd...

[2] https://github.com/KingdomStudiosIO/contracts/blob/51873b574...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: