[all-commits] [llvm/llvm-project] 67c6ad: [clang][analyzer] Model allocation behavior or get...

Alejandro Álvarez Ayllón via All-commits all-commits at lists.llvm.org
Wed Mar 6 07:52:30 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 67c6ad6f30e35c7670bce9bca902caa4b1c8c0e8
      https://github.com/llvm/llvm-project/commit/67c6ad6f30e35c7670bce9bca902caa4b1c8c0e8
  Author: Alejandro Álvarez Ayllón <alejandro.alvarez at sonarsource.com>
  Date:   2024-03-06 (Wed, 06 Mar 2024)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
    M clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
    M clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp
    M clang/test/Analysis/Inputs/system-header-simulator-for-malloc.h
    A clang/test/Analysis/getline-alloc.c

  Log Message:
  -----------
  [clang][analyzer] Model allocation behavior or getdelim/geline (#83138)

`getdelim` and `getline` may free, allocate, or re-allocate the input
buffer, ensuring its size is enough to hold the incoming line, the
delimiter, and the null terminator.

`*lineptr` must be a valid argument to `free`, which means it can be
either

1. `NULL`, in which case these functions perform an allocation
equivalent to a call to `malloc` even on failure.
2. A pointer returned by the `malloc` family of functions. Other
pointers are UB (`alloca`, a pointer to a static, to a stack variable, etc.)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list