Open Quuxplusone opened 5 years ago
I think this happens because you don't have core checkers enabled. If you enable core checkers, the uninitialized value checker will emit a fatal error and prevent the undefined value from reaching CStringChecker. There are a lot of places in the code in which we rely on absence of undefined values simply because there's a core checker that catches them preemptively for us.
Oh, I see it now. Actually I did some experiment with the test cstring-syntax.c
in the trunk where it crashed. When I tried the same in release 8.0 it did not beacause unix.cstring.BadSizeArg
did not depend on any other C string checker. However, now it depends on CStringModeling
so it crashes. If I put the test to its proper place, bstring.c
the crash goes away. The main difference between the two test files is indeed that in the invocations lines cstring-syntax.c
omits the core
checkers, which is wrong. It does not currently crash but it is non standard so I propose to include them there as well to prevent future misunderstandings and also to ensure correct testing of the unix.cstring
checkers. I will do the fix if you agree.
I was thinking a bit on it. It is one thing to add core checkers in the test, but there should be no way for the user to crash the analyzer. Error messages yes, crash no. Somehow we must ensure that the correct dependencies are met.
One way is to add the dependencies one by one into the Checkers.td but the we should find out exactly which core checker is needed here to prevent the crash. The other way is to make the dependencies of the core checkers implicit for all other checkers (or at least all path sensitive checkers).
Maybe we should continue this discussion on the cfe-dev list?
Given the following faulty C code (the programmer forgot that taking address of an array is the same as the array itself which is handled as an address):
Analyzing this code with any C-String checker enabled results in an assertion failure: