[all-commits] [llvm/llvm-project] 42ae05: [NFC] Fix potential for use-after-free in DumpModu...

Mariya Podchishchaeva via All-commits all-commits at lists.llvm.org
Thu Mar 30 03:45:41 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 42ae055b4c9282050636dd11198cad500424adf2
  Author: Mariya Podchishchaeva <mariya.podchishchaeva at intel.com>
  Date:   2023-03-30 (Thu, 30 Mar 2023)

  Changed paths:
    M clang/include/clang/Frontend/FrontendActions.h
    M clang/lib/Frontend/FrontendActions.cpp
    M lldb/source/Commands/CommandObjectTarget.cpp

  Log Message:
  [NFC] Fix potential for use-after-free in DumpModuleInfoAction

Since each `DumpModuleInfoAction` can now contain a pointer to a
`raw_ostream`, saving there a poiter that owned by a local `unique_ptr`
may cause use-after-free. Clarify ownership and save a `shared_ptr`
inside of `DumpModuleInfoAction` instead.
Found by static analyzer.

Reviewed By: tahonermann, aaron.ballman

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

More information about the All-commits mailing list