[clang] [clang] Check upperbound for attribute param index (PR #180424)
marius doerner via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 9 08:41:36 PST 2026
Marius =?utf-8?q?Dörner?= <marius.doerner1 at icloud.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/180424 at github.com>
================
@@ -5186,8 +5186,9 @@ class Sema final : public SemaBase {
return false;
}
- unsigned IdxSource = IdxInt->getLimitedValue(UINT_MAX);
- if (IdxSource < 1 ||
+ constexpr unsigned Limit = 1 << ParamIdx::IdxBitWidth;
+ unsigned IdxSource = IdxInt->getLimitedValue(Limit);
+ if (IdxSource < 1 || IdxSource == Limit ||
----------------
mariusdr wrote:
`getLimitedValue` is required in any way to get the unsigned value out of the `APSInt` instance, so I thought I just make use of the limit.
https://github.com/llvm/llvm-project/pull/180424
More information about the cfe-commits
mailing list