3 ms·
Last year I dug up Kernighan's 2012 release of awk, fixed up the test suite packaging and automated it, and wrote a makefile which adds clang ASAN support. It
by chubot 10y ago
Last year I dug up Kernighan's 2012 release of awk, fixed up the test suite packaging and automated it, and wrote a makefile which adds clang ASAN support.
It found a couple bugs because the test suite is quite comprehensive. I think it's somewhat interesting that 5000 or so lines of C code polished over 20 years still has memory bugs.
I didn't fix the bugs, but anyone should feel free to clone it and maybe get some karma points from Kernighan. Maybe he will make a 2017 release. He is fairly responsive to email from what I can tell :)
https://github.com/andychu/bwk https://github.com/andychu/bwk
- nickpsecurity 10y ago" I think it's somewhat interesting that 5000 or so lines of C code polished over 20 years still has memory bugs." Typical might be the word you're looking for there. The CompSci people doing static analysis for C programs often apply them to popular FOSS. They find new errors about every time.
- qwertyuiop924 10y agoAs much as I defend C, if you're using C in a non-embedded environment, and you're handling any sort of textual input... don't. In fact, even if you're not handling textual input, think about not doing it.
- adrianN 10y agoWritten by someone who you'd have to call "competent C programmer" to boot.
- chubot 10y agoYeah, I think the real problem is that the functional tests actually pass (on my machine, and most, I would assume). But the C code is invalid. In many circumstances, a one byte buffer overrun is exceedingly likely to "work", but ASAN flags those as bugs with 100% reliability. If I recall, it also had eiter a use-after-free or double free. The former can obviously cause problems but may not, not sure about the latter.