News for hackers. Stuff that matters.
Re:Always Bump Downwards (2019) by dev_dwarf on Tuesday September 19, 2023 @02:03PM (#37573754)
Interesting point. I modified my example to test what you described. I had to play with the compilation flags to get the allocs to not be optimized out and to not panic when the integer overflow happens, but otherwise I didn't change the logic. I'm pretty sure my implementation is correctly handling the case you mention, evidenced by it returning a null pointer.

Link: https://godbolt.org/z/f1jGW6Pa3

Update: NVM, definitely not being handled correctly. https://godbolt.org/z/cMTe1o979

There are no comments on this comment yet.