|
|
|
|
|
by menaerus
1614 days ago
|
|
This got nothing to do with the memory but to the fact how CPU works with the integers. This means that (low-level) programming language fundamentally cannot solve this problem but only alleviate it either by: 1. Changing the semantics of integer arithmetic (e.g. saturate on overflow) 2. Keeping the semantics but babysit the computation during runtime so that the overflow/underflow can never happen (expensive) |
|
It is not expensive to check for under flow at runtime in security critical code, and is actually mandatory for cases like this as it is UB in C.