--- src/compiler/translator/IntermNode.cpp.orig +++ src/compiler/translator/IntermNode.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -876,7 +877,15 @@ if (isArray()) { size_t elementSize = mArguments.front()->getAsTyped()->getType().getObjectSize(); - constArray = new TConstantUnion[elementSize * getOutermostArraySize()]; + size_t arraySize = getOutermostArraySize(); + // Overflow should never happen due to parser validation, but hardened here just in case. + // http://crbug.com/498400132. Manual check instead of CheckedNumeric, which gcc cannot + // compile here: https://trac.macports.org/ticket/74110 + if (elementSize != 0 && arraySize > SIZE_MAX / elementSize) + { + abort(); + } + constArray = new TConstantUnion[elementSize * arraySize]; size_t elementOffset = 0u; for (TIntermNode *constructorArg : mArguments)