Live data from Hacker News

RabbitMQ integer overflow that leads to heap memory corruption

cve.mitre.org

21–25 of 25 posts

Re: RabbitMQ integer overflow that leads to heap memory corruption

#21

Earlier quoted context omitted.

Mathematics in C is modular arithmetic built as an abstraction on top of fixed-width numbers. One has to keep reminding oneself of this fact. This got etched in my brain after I saw a piece of code that calculated the middle index of an array in a roundabout way mid = left+ (right-left) /2 instead of mid = (right +left) / 2 Although even this code can cause overflows, it has served as a reminder to be cautious even w…

> One has to keep reminding oneself of this fact. No, one doesn't need to do this, and no matter how hard you try, ths doesn't work in practice since you only need to slip once to introduce a CVE into your program. What we need is for compilers to start calling `abort` by default on any kind of integer overflow. If you have a piece of C code in which you actually need integers to overflow with some particular semanti…

[deleted]

Re: RabbitMQ integer overflow that leads to heap memory corruption

#22

Earlier quoted context omitted.

Mathematics in C is modular arithmetic built as an abstraction on top of fixed-width numbers. One has to keep reminding oneself of this fact. This got etched in my brain after I saw a piece of code that calculated the middle index of an array in a roundabout way mid = left+ (right-left) /2 instead of mid = (right +left) / 2 Although even this code can cause overflows, it has served as a reminder to be cautious even w…

> One has to keep reminding oneself of this fact. No, one doesn't need to do this, and no matter how hard you try, ths doesn't work in practice since you only need to slip once to introduce a CVE into your program. What we need is for compilers to start calling `abort` by default on any kind of integer overflow. If you have a piece of C code in which you actually need integers to overflow with some particular semanti…

Doesn't Rust arithmetic wraparound on release? I read Microsoft's Midori language paniced/abandoned on overflow even in release, and the compiler got quite good at optimizing overflow checks away.

Re: RabbitMQ integer overflow that leads to heap memory corruption

#23
post #22

Earlier quoted context omitted.

> One has to keep reminding oneself of this fact. No, one doesn't need to do this, and no matter how hard you try, ths doesn't work in practice since you only need to slip once to introduce a CVE into your program. What we need is for compilers to start calling `abort` by default on any kind of integer overflow. If you have a piece of C code in which you actually need integers to overflow with some particular semanti…

Doesn't Rust arithmetic wraparound on release? I read Microsoft's Midori language paniced/abandoned on overflow even in release, and the compiler got quite good at optimizing overflow checks away.

The rules are slightly more complex than that to allow the behavior to change in the future, but they currently two’s compliment wrapping, yes.

Re: RabbitMQ integer overflow that leads to heap memory corruption

#24
post #22

Earlier quoted context omitted.

> One has to keep reminding oneself of this fact. No, one doesn't need to do this, and no matter how hard you try, ths doesn't work in practice since you only need to slip once to introduce a CVE into your program. What we need is for compilers to start calling `abort` by default on any kind of integer overflow. If you have a piece of C code in which you actually need integers to overflow with some particular semanti…

Doesn't Rust arithmetic wraparound on release? I read Microsoft's Midori language paniced/abandoned on overflow even in release, and the compiler got quite good at optimizing overflow checks away.

If you wrap around you get implementation defined behavior, which can be chosen to either panic!, or wrap-around. In release, the default is wrap-around, but you can set it to panic.

Re: RabbitMQ integer overflow that leads to heap memory corruption

#25

Earlier quoted context omitted.

Mathematics in C is modular arithmetic built as an abstraction on top of fixed-width numbers. One has to keep reminding oneself of this fact. This got etched in my brain after I saw a piece of code that calculated the middle index of an array in a roundabout way mid = left+ (right-left) /2 instead of mid = (right +left) / 2 Although even this code can cause overflows, it has served as a reminder to be cautious even w…

> One has to keep reminding oneself of this fact. No, one doesn't need to do this, and no matter how hard you try, ths doesn't work in practice since you only need to slip once to introduce a CVE into your program. What we need is for compilers to start calling `abort` by default on any kind of integer overflow. If you have a piece of C code in which you actually need integers to overflow with some particular semanti…

> What we need is for compilers to start calling `abort` by default on any kind of integer overflow

GCC supports this for C and C++, but it's off by default. I don't know if any distros build with this flag (-ftrapv) enabled. Seems like a good idea.

https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html

https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.h...

Post reply on HN