[clang] [Clang][Sema] Fix out-of-bounds access (PR #80978)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 7 04:09:11 PST 2024
https://github.com/Sirraide updated https://github.com/llvm/llvm-project/pull/80978
>From 366651f687eb58ab1775e88da55b1489c118e874 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Wed, 7 Feb 2024 12:49:18 +0100
Subject: [PATCH 1/2] [Clang][Sema] Fix out-of-bounds access
---
clang/lib/Sema/SemaOverload.cpp | 4 ++--
clang/test/SemaCXX/cxx2b-deducing-this.cpp | 10 ++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 6a04d68b4f041..ebbbdac631ed2 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -7719,8 +7719,8 @@ bool Sema::CheckNonDependentConversions(
unsigned Offset =
Method && Method->hasCXXExplicitFunctionObjectParameter() ? 1 : 0;
- for (unsigned I = 0, N = std::min(ParamTypes.size(), Args.size()); I != N;
- ++I) {
+ for (unsigned I = 0, N = std::min(ParamTypes.size() - Offset, Args.size());
+ I != N; ++I) {
QualType ParamType = ParamTypes[I + Offset];
if (!ParamType->isDependentType()) {
unsigned ConvIdx;
diff --git a/clang/test/SemaCXX/cxx2b-deducing-this.cpp b/clang/test/SemaCXX/cxx2b-deducing-this.cpp
index aab35828096a8..30131d6adc4db 100644
--- a/clang/test/SemaCXX/cxx2b-deducing-this.cpp
+++ b/clang/test/SemaCXX/cxx2b-deducing-this.cpp
@@ -636,3 +636,13 @@ struct D {
}
};
}
+
+namespace GH80971 {
+struct S {
+ auto f(this auto self...) { }
+};
+
+int bug() {
+ S{}.f(0);
+}
+}
>From 9545bf33c4d0cd3448f31e07935f84f46c055f97 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Wed, 7 Feb 2024 13:08:59 +0100
Subject: [PATCH 2/2] [Clang] Update release notes
---
clang/docs/ReleaseNotes.rst | 2 ++
1 file changed, 2 insertions(+)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 3596109bf044f..55497cc7883bc 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -201,6 +201,8 @@ Bug Fixes to C++ Support
parameter where we did an incorrect specialization of the initialization of
the default parameter.
Fixes (`#68490 <https://github.com/llvm/llvm-project/issues/68490>`_)
+- Fix a crash when trying to call a varargs function that also has an explicit object parameter.
+ Fixes (`#80971 ICE when explicit object parameter be a function parameter pack`)
Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
More information about the cfe-commits
mailing list