[all-commits] [llvm/llvm-project] 635778: [clang-tidy] fix nullptr dereference in bugprone-f...

Julian Schmidt via All-commits all-commits at lists.llvm.org
Tue Sep 17 01:42:29 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6357781e3f9fbc5a14a794b8769b451c863c65c7
      https://github.com/llvm/llvm-project/commit/6357781e3f9fbc5a14a794b8769b451c863c65c7
  Author: Julian Schmidt <git.julian.schmidt at gmail.com>
  Date:   2024-09-17 (Tue, 17 Sep 2024)

  Changed paths:
    M clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/test/clang-tidy/checkers/bugprone/forwarding-reference-overload.cpp

  Log Message:
  -----------
  [clang-tidy] fix nullptr dereference in bugprone-forwarding-reference (#106856)

Previously, when checking if a `TemplateSpecializationType` is either
`enable_if` or `enable_if_t`, the AST matcher would call
`getTemplateName`, `getASTemplateDecl` and `getTemplatedDecl` in
succession to check the `NamedDecl` returned from `getTemplatedDecl` is
an `std::enable_if[_t]`. In the linked issue, the pointer returned by 
`getTemplatedDecl` is a `nullptr` that is unconditionally accessed, 
resulting in a crash. Instead, the checking is done on the
`TemplateDecl`
returned by `getASTemplateDecl`.

Fixes #106333



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