[all-commits] [llvm/llvm-project] ee073c: [analyzer][StdLibraryFunctionsChecker] Fix typos i...

Balazs Benics via All-commits all-commits at lists.llvm.org
Mon Nov 30 09:07:19 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ee073c798515e56b23463391a7b40d5ee6527337
      https://github.com/llvm/llvm-project/commit/ee073c798515e56b23463391a7b40d5ee6527337
  Author: Balazs Benics <benicsbalazs at gmail.com>
  Date:   2020-11-30 (Mon, 30 Nov 2020)

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

  Log Message:
  -----------
  [analyzer][StdLibraryFunctionsChecker] Fix typos in summaries of mmap and mmap64

The fd parameter of
```
void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset)
```
should be constrained to the range [0, IntMax] as that is of type int.
Constraining to the range [0, Off_tMax] would result in a crash as that is
of a signed type with the value of 0xff..f (-1).

The crash would happen when we try to apply the arg constraints.
At line 583: assert(Min <= Max), as 0 <= -1 is not satisfied

The mmap64 is fixed for the same reason.

Reviewed By: martong, vsavchenko

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




More information about the All-commits mailing list