[PATCH] D31868: [analyzer] Check NULL pointer dereference issue for memset function

Leslie Zhai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 10 11:07:28 PDT 2017


xiangzhai created this revision.

Hi LLVM developers,

As Anna mentioned:

> One idea is to check that we do not pass a pointer that is known to be NULL to functions that are known to dereference pointers such as memcpy. There is a checker that determines if a null pointer could be dereferenced already, but there is no extension to check if such a pointer could be passed to a function tat could dereference it.

So I implemented `evalMemset` in the CStringChecker to detect null-deref issue. please review my patch, thanks a lot!

Regards,
Leslie Zhai


Repository:
  rL LLVM

https://reviews.llvm.org/D31868

Files:
  lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  test/Analysis/null-deref-ps-region.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31868.94627.patch
Type: text/x-patch
Size: 4238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170410/edc1ad93/attachment.bin>


More information about the cfe-commits mailing list