Re:Imposing memory security in C [video]
by pizlonator on Thursday February 27, 2025 @03:06PM
(#43197908)
> C's memory safety could be drastically improved with the addition of bounds-checked arrays (which is an extension, and does not change existing code):
If you solved that problem then you'd still have a dumpster fire of memory safety issues from bad casts, use after free, etc
Re:Imposing memory security in C [video]
by WalterBright on Thursday February 27, 2025 @03:48PM
(#43198347)
Array overflows is consistently the number one memory safety bug in shipped code, by a wide margin.
Re:Imposing memory security in C [video]
by pizlonator on Thursday February 27, 2025 @04:00PM
(#43198464)
Citation needed.
(I would have guessed similar to what you said, minus the "by a wide margin" bit.)
Re:Imposing memory security in C [video]
by WalterBright on Thursday February 27, 2025 @04:10PM
(#43198543)
Re:Imposing memory security in C [video]
by pizlonator on Thursday February 27, 2025 @04:46PM
(#43198858)
Neither of those support your claim that buffer overflows are the top issue by a wide margin.
If you are saying that “most memory safety issues are bounds related” then I agree. I’m just disagreeing on the wide margin bit.
Re:Imposing memory security in C [video]
by WalterBright on Thursday February 27, 2025 @06:50PM
(#43199948)
> Neither of those support your claim that buffer overflows are the top issue by a wide margin
That's true, but I have seen that statistic more than once, and decided that I wasn't going to spend more time searching for it.
If that's not good enough for you, so be it.
https://www.digitalmars.com/articles/C-biggest-mistake.html
25 years of experience with D has shown this to be a huge improvement.
D also has references as an alternative to pointers. References cannot have arithmetic done on them. Hence, by replacing pointers with references, and with array bounds checking, the incidence of memory corruption is hugely reduced.