[cfe-commits] [PATCH] review request - strcmp checker
kremenek at apple.com
Fri Apr 8 16:37:08 PDT 2011
I understand the intent is to model comparing raw string literals, but I think the use of getCStringLiteral() discards too much information. For example, I don't think the following will be handled correctly:
const char *s1 = "foobar";
const char *s2 = "bar";
return strcmp(&s1, s2);
In order to model strcmp() properly, you will also need to take into account the offset within the string literal.
Also, could you add a FIXME indicating that this logic only handles comparing string literals (albeit, it handles flow analysis)? Conceptually, we could enhance this to also handle non-literals as well in a variety of ways.
On Apr 8, 2011, at 1:51 PM, Lenny Maiorani wrote:
> On 04/08/2011 10:28 AM, Lenny Maiorani wrote:
>> This patch adds modeling of strcmp() to the CString checker. Validates inputs are not NULL and are real C strings, then does the comparison and binds the proper return value. Unit tests included.
> Oops. Empty patch. Thanks Joerg.
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
More information about the cfe-commits