ergoplatform / ergo

Ergo protocol description & reference client implementation
https://ergoplatform.org/
Creative Commons Zero v1.0 Universal
504 stars 170 forks source link

Fix the ArithUtils.multiplyExact arithmetic #1535

Open aslesarenko opened 2 years ago

aslesarenko commented 2 years ago

Not sure such method is secure. What kind of arithmetic it is?

I'm talking about catching exceptions and returning Long.MaxValue. What about negative overflow?

This method is used for cost calculation, so likely no subsequent problems. But I think this should be fixed.

_Originally posted by @aslesarenko in https://github.com/ergoplatform/ergo/pull/1490#discussion_r769687500_

jozanek commented 1 year ago

@aslesarenko do you mean to fix the negative overflow?