go-money
go-money copied to clipboard
Fix Integer Overflow in Allocate Function
This PR addresses an integer overflow issue in the Allocate
function. When the sum of given ratios exceeds the maximum value for an int64
, it results in a negative value, causing runtime errors. This fix includes:
- Updating the
Allocate
function to check for potential overflows. - Adding a new test case to ensure the error is correctly handled.
Related Issues
- Fixes #136