4 ms·
5) The provided Mid implementation will panic for signed integer types. There's a part where it sorts `self` and `other`, then subtracts. let difference =
by bqmjjx0kac 2y ago
5) The provided Mid implementation will panic for signed integer types.
There's a part where it sorts `self` and `other`, then subtracts.
let difference = *large - *small;
Suppose large is 0 and small is i32::MIN. Kaboom, right?
For reference: https://github.com/dfinity/ic/commit/79aca8ede9fccd322e0e01183ee72c0bc3ed2e61#diff-41cafdf6b2a805c65ef8163a866c3924a49b2487d6588dda414cfd42005cc44cR19 https://github.com/dfinity/ic/commit/79aca8ede9fccd322e0e011...