Re:How expensive is integer-overflow trapping in C++?
by asveikau on Thursday September 24, 2020 @10:09AM
(#24578741)
> If you don't abort then you probably have an arbitrary code execution vulnerability.
There are some patterns in which that is totally true, for example if an integer product is passed to malloc or realloc. Those cases tend to get extra scrutiny in security reviews because it is a well known class of issues. However, it is certainly not the case that every case is exploitable.
Re:How expensive is integer-overflow trapping in C++?
by lmm on Thursday September 24, 2020 @07:58PM
(#24585074)
Not every case is exploitable, but people are bad at reasoning about which cases are exploitable; a lot of DoS bugs that are initially thought to be harmless turn out to be exploitable. So I think it's important to treat any UB as exploitable until proven otherwise.
Re:How expensive is integer-overflow trapping in C++?
by higerordermap on Thursday September 24, 2020 @06:33AM
(#24577178)
He is saying it should raise an exception which can be caught somewhere up the stack.
Re:How expensive is integer-overflow trapping in C++?
by asveikau on Thursday September 24, 2020 @11:14AM
(#24579362)
Yes, but I would take minor issue in that I wasn't saying what should happen so much as what the options are given various tradeoffs.
There are programming communities that have criticisms of exceptions and would like to avoid them. I am sympathetic to that. But if you do have exceptions, this is a good candidate. If you don't have exceptions, making integer overflow trap seems problematic. Posix signals may be another solution, with its own problems and ugliness.
If you don't abort then you probably have an arbitrary code execution vulnerability. Overflow is undefined behaviour in C++, your code is in an unanticipated state, a creative attacker can probably leverage that to do anything.