[all-commits] [llvm/llvm-project] defd95: [analyzer] Fix StdLibraryFunctionsChecker NotNull ...

vabridgers via All-commits all-commits at lists.llvm.org
Mon Mar 30 12:13:26 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: defd95ef45171252ee8491729d3f3c863bbfe530
      https://github.com/llvm/llvm-project/commit/defd95ef45171252ee8491729d3f3c863bbfe530
  Author: Vince Bridgers <vince.a.bridgers at gmail.com>
  Date:   2020-03-30 (Mon, 30 Mar 2020)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
    M clang/test/Analysis/std-c-library-functions.c

  Log Message:
  -----------
  [analyzer] Fix StdLibraryFunctionsChecker NotNull Constraint Check

Summary:
This check was causing a crash in a test case where the 0th argument was
uninitialized ('Assertion `T::isKind(*this)' at line SVals.h:104). This
was happening since the argument was actually undefined, but the castAs
assumes the value is DefinedOrUnknownSVal.

The fix appears to be simply to check for an undefined value and skip
the check allowing the uninitalized value checker to detect the error.

I included a test case that I verified to produce the negative case
prior to the fix, and passes with the fix.

Reviewers: martong, NoQ

Subscribers: xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, Charusso, ASDenysPetrov, baloghadamsoftware, dkrupp, cfe-commits

Tags: #clang

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




More information about the All-commits mailing list