Great!  Looks good to me.

On Apr 25, 2011, at 10:19 AM, Lenny Maiorani wrote:

> On 04/22/2011 06:07 PM, Ted Kremenek wrote:
>> On Apr 15, 2011, at 1:27 PM, Lenny Maiorani wrote:
>> 
>>> Implements the strncmp() checker just like the strcmp() checker, but with 
>>> bounds. Requires LLVM svn r129582.
>>> 
>>> Please review.
>>> 
>>> -Lenny
>> 
>> Hi Lenny,
>> 
>> This parts looks a bit suspect:
>> 
>> +  int result;
>> +  if (isBounded) {
>> +    // Get the max number of characters to compare.
>> +    const Expr *lenExpr = CE->getArg(2);
>> +    SVal lenVal = state->getSVal(lenExpr);
>> +    nonloc::ConcreteInt *CI = dyn_cast<nonloc::ConcreteInt>(&lenVal);
>> +    llvm::APSInt lenInt(CI->getValue());
>> 
>> There is no guarantee that lenVal will be a nonloc::ConcreteInt.  This means 
>> that the last line could be a null dereference.
>> 
>> Cheers,
>> Ted
> Hi Ted,
> 
> Ah yes. You are right. Attached is an updated patch which should fix that. 
> Please review.
> 
> -Lenny
> 
> 
> <strncmp-checker-2.diff>

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to