5 ms·
Re-checking the ReactOS project - a large report
- Maxious 14y agoSee previously John Carmack on the importance of static analysis http://www.altdevblogaday.com/2011/12/24/static-code-analysis/ http://www.altdevblogaday.com/2011/12/24/static-code-analysi... https://news.ycombinator.com/item?id=4543553 https://news.ycombinator.com/item?id=4543553
- melling 14y agoAre there good low-end tools for C/C++? I've been doing iOS development and I recently decided to write some of my code in C++ so it would be portable to Android and Blackberry.
- swatkat 14y agoCppcheck. http://cppcheck.sourceforge.net/ http://cppcheck.sourceforge.net/
- micampe 14y agoIf you’ve been working on iOS you already have it installed http://clang-analyzer.llvm.org http://clang-analyzer.llvm.org
- melling 14y agoYes, Xcode with clang is really nice. After reading Carmack's blog, however, I'm sure more can be done. He actually like's Microsoft's compiler. Wonder if it's worth running code through it?
- johnsoft 14y agoFrom the title, I was expecting to read a review of ReactOS looking at whether it would be viable as a day-to-day OS. This leaves me a little bit disappointed.
- gecko 14y agoOkay, I'll write that review: No. It's unstable, it lacks support for any filesystem but FAT32, it lacks meaningful driver compatibility with Windows, it doesn't support multiple users, it doesn't support major APIs like thread pools/WMI/WDDM, its TCP stack is nascent, there is no SMB support... I want this project to succeed, but it needs a lot of love to get there.
- microtherion 14y agoOne of the NULL dereference diagnostics looks spurious: DomainName = &PolicyAccountDomainInfo->DomainName; SidNameUse = (PolicyAccountDomainInfo != NULL ? SidTypeGroup : SidTypeUser); This does not, in fact, dereference PolicyAccountDomainInfo, but simply performs some pointer arithmetic. It’s bad style, agreed, but should be entirely harmless to execute.
- pkolaczk 14y agoDoing anything with invalid pointers is UB in C++. It might be fine now, but it might not work in 5 years, when compiled with a newer compiler. E.g. a sufficiently clever, malicious compiler could reason that because you are doing pointer arithmetic involving PolicyAccountDomainInfo->, the pointer must be valid and then it might get rid of the null check and branch in the second line. I remember not so long ago there was a vulnerability in Linux kernel because of exactly this kind of "malicious" optimisation performed by gcc.
- Someone 14y agohttps://isc.sans.edu/diary/A+new+fascinating+Linux+kernel+vulnerability/6820 https://isc.sans.edu/diary/A+new+fascinating+Linux+kernel+vu...
- twoodfin 14y agoExactly, though in the case I bet you're remembering, the pointer was dereferenced before the null check so the latter was optimized out. http://lwn.net/Articles/342330/ http://lwn.net/Articles/342330/
- microtherion 14y agoAs others have commented, the Linux incident involved an actual dereferencing of the pointer. The way I read http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf top of page 89 and footnote 102 on that page is that this is NOT undefined behavior in C, and though I haven’t checked the corresponding language in the C++ standard, I would think it’s not undefined in C++ either.
- pkolaczk 14y agoHmm, don't ReactOS developers use IDEs? Or do C++ IDEs lack advanced static analysis features?
- TazeTSchnitzel 14y agoIt depends. Some of us use Visual Studio. Some of us use gedit.
- fabriceleal 14y agoIf you do use Visual Studio, it would be interesting to know what do you think about its static analysis (or absence of)
- fabriceleal 14y agoI might be completely wrong but Visual Studio's static analysis for C++ is not very smart
- topbanana 14y agoInteresting project. Is it fairly easy to get up and running as a contributor?
- TazeTSchnitzel 14y agoYes! There's a single build environment (RosBe) to download (for both Windows and *NIX), then you just need to do an svn checkout (svn is included in the environment), and then make a patch and submit it for some bug.