[all-commits] [llvm/llvm-project] 5a2e59: [analyzer] Fix Static Analyzer g_memdup false-posi...

Balazs Benics via All-commits all-commits at lists.llvm.org
Mon May 2 01:36:23 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5a2e595eb8337e6e36da8ec2289b5c4097522f5b
      https://github.com/llvm/llvm-project/commit/5a2e595eb8337e6e36da8ec2289b5c4097522f5b
  Author: Balazs Benics <balazs.benics at sigmatechnology.se>
  Date:   2022-05-02 (Mon, 02 May 2022)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
    M clang/test/Analysis/gmalloc.c

  Log Message:
  -----------
  [analyzer] Fix Static Analyzer g_memdup false-positive

`g_memdup()` allocates and copies memory, thus we should not assume that
the returned memory region is uninitialized because it might not be the
case.

PS: It would be even better to copy the bindings to mimic the actual
content of the buffer, but this works too.

Fixes #53617

Reviewed By: martong

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




More information about the All-commits mailing list