We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2f1d93f commit d541a4cCopy full SHA for d541a4c
clang/lib/AST/ASTContext.cpp
@@ -852,7 +852,9 @@ ASTContext::getTypeInfo(const Type *T) const {
852
const ConstantArrayType *CAT = cast<ConstantArrayType>(T);
853
854
std::pair<uint64_t, unsigned> EltInfo = getTypeInfo(CAT->getElementType());
855
- Width = EltInfo.first*CAT->getSize().getZExtValue();
+ uint64_t Size = CAT->getSize().getZExtValue();
856
+ assert((Size == 0 || EltInfo.first <= (uint64_t)(-1)/Size) && "Overflow in array type bit size evaluation");
857
+ Width = EltInfo.first*Size;
858
Align = EltInfo.second;
859
Width = llvm::RoundUpToAlignment(Width, Align);
860
break;
0 commit comments