[all-commits] [llvm/llvm-project] bd7bce: Fix null-deref thanks to an attribute on a global ...

Erich Keane via All-commits all-commits at lists.llvm.org
Mon Mar 4 09:25:41 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bd7bce2c8465e9cb36a823846a52c9f553502575
      https://github.com/llvm/llvm-project/commit/bd7bce2c8465e9cb36a823846a52c9f553502575
  Author: Erich Keane <ekeane at nvidia.com>
  Date:   2024-03-04 (Mon, 04 Mar 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Sema/DeclSpec.h
    M clang/include/clang/Sema/ParsedAttr.h
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Sema/ParsedAttr.cpp
    A clang/test/Parser/cxx-declarator-attribute-crash.cpp

  Log Message:
  -----------
  Fix null-deref thanks to an attribute on a global declarator chunk (#83611)

This was reported (sort of) in a PR: #77703. The problem is that a
declarator 'owns' an attributes allocation via an `AttributePool`.
However, this example tries to copy a DeclaratorChunk from one
Declarator to another, so when the temporary Declarator goes out of
scope, it deletes the attribute it has tried to pass on via the chunk.

This patch ensures that we copy the 'ownership' of the attribute
correctly, and adds an assert to catch any other casess where this
happens.

Additionally, this was put in as a bug report, so this
Fixes #83611



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