4 ms·
Not the iPhone itself but all C and C++ codebases. It's possible to write code in these languages without these bugs, but there's a strong positive correlation
by ndesaulniers 7y ago
Not the iPhone itself but all C and C++ codebases. It's possible to write code in these languages without these bugs, but there's a strong positive correlation between lines of code written in these languages, and this class of bug. Other languages will either insert a check before access (which is overhead) or try to elide it as a compiler optimization.
Current static analyses are imprecise, while dynamic analyses require actual execution which can be difficult.
Modern research is looking to combine the two. Rather than brute force fuzzing (dynamic analysis), static analyze the source to better mutate the input to a few potentially interesting cases.
- lilyball 7y ago> It's possible to write code in these languages without these bugs I would go so far as to say in any non-trivial codebase it's virtually impossible to avoid introducing a bug of this nature. SQLite is probably the codebase that has the highest chance of being safe from this, due to its extremely thorough test suite and amount of fuzzing that's been done, but even that codebase was found to have a significant bug (I forget the details) in one of the optional first-party extensions, as that extension did not have the same rigorous test suite that the SQLite core did. To be clear, when I say thorough test suite, IIRC SQLite's test suite has 3x as many lines of code as the code being tested. And I think there's some sort of instrumentation to ensure the test suite covers every single code path.
- nojvek 7y agoCovering the every single branch of code isn’t enough. One needs to test that every single branch isn’t vulnerable to an overflow attack. It’s kind of testing every possible valid, invalid and malicious input the program can take in. Gets even crazier with race conditions and such. Testing is really hard. And given how many companies skip on testing I am led to believe security is a myth. There’s gonna be someone somewhere with an exploit getting your info.
- eridius 7y agoYeah, which is why fuzzing is important even with tests covering every code path. And even with that, this is why I simply said that SQLite is probably the codebase that comes the closest, rather than saying it actually is bug-free.
- maoeurk 7y ago> IIRC SQLite's test suite has 3x as many lines of code as the code being tested Actually it has a shocking 662x as many lines of tests as it has code[1]. I agree though, SQLite is an amazing piece of software. [1]: https://sqlite.org/testing.html https://sqlite.org/testing.html
- LorenPechtel 7y agoMy opinion: Programs, like ships, sink in the C. C++? In C++ that means take C, make it better but use the original. Give me a strongly typed language and check for overflows and the like!