[analyzer] Improve the modeling of memset().
authorHenry Wong <movietravelcode@outlook.com>
Wed, 16 May 2018 12:37:53 +0000 (12:37 +0000)
committerHenry Wong <movietravelcode@outlook.com>
Wed, 16 May 2018 12:37:53 +0000 (12:37 +0000)
commitafe62cdc4e411953f3ceea398ad50d9862323dd7
tree742992b13b20774ae83e93552f17c4a78d4a67ca
parent6c35f8f445b0627a7563b2c5c2d3fe3dc2fd6a06
[analyzer] Improve the modeling of memset().

Since there is no perfect way bind the non-zero value with the default binding, this patch only considers the case where buffer's offset is zero and the char value is 0. And according to the value for overwriting, decide how to update the string length.

Reviewers: dcoughlin, NoQ, xazax.hun, a.sidorin, george.karpenkov

Reviewed By: NoQ

Differential Revision: https://reviews.llvm.org/D44934

llvm-svn: 332463
clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
clang/test/Analysis/bstring.cpp
clang/test/Analysis/null-deref-ps-region.c
clang/test/Analysis/string.c