[all-commits] [llvm/llvm-project] e913a3: [-Wunsafe-buffer-usage] Emit a warning if pointer ...

Malavika Samak via All-commits all-commits at lists.llvm.org
Thu Oct 17 13:48:57 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e913a33fcfbd667e4e3a35919b6bd9c5876a90a3
      https://github.com/llvm/llvm-project/commit/e913a33fcfbd667e4e3a35919b6bd9c5876a90a3
  Author: Malavika Samak <malavika.samak at gmail.com>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Analysis/UnsafeBufferUsage.cpp
    M clang/lib/Sema/AnalysisBasedWarnings.cpp
    M clang/test/SemaCXX/warn-unsafe-buffer-usage-warning-data-invocation.cpp

  Log Message:
  -----------
  [-Wunsafe-buffer-usage] Emit a warning if pointer returned by vector::data and array::data is cast to larger type (#111910)

Emit a warning when the raw pointer retrieved from std::vector and
std::array instances are cast to a larger type. Such a cast followed by
a field dereference to the resulting pointer could cause an OOB access.
This is similar to the existing span::data warning.

(rdar://136704278)

Co-authored-by: MalavikaSamak <malavika2 at apple.com>



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