[clang] [clang][bytecode] Fix crash on arrays with excessive size (PR #175402)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 10 23:48:32 PST 2026


================
@@ -411,7 +411,7 @@ Descriptor *Program::createDescriptor(const DeclTy &D, const Type *Ty,
       if (OptPrimType T = Ctx.classify(ElemTy)) {
         // Arrays of primitives.
         unsigned ElemSize = primSize(*T);
-        if (std::numeric_limits<unsigned>::max() / ElemSize <= NumElems) {
+        if (Descriptor::MaxArrayElemBytes / ElemSize < NumElems) {
----------------
cor3ntin wrote:

can we add parentheses here?

https://github.com/llvm/llvm-project/pull/175402


More information about the cfe-commits mailing list