Throwing stack too deep ICE in case of calling encode with too many arguments instead of invalid opcode

This commit is contained in:
Djordje Mijovic 2020-03-04 16:16:30 +01:00
parent a3bc752e53
commit 38b219d140

View File

@ -539,6 +539,10 @@ void CompilerUtils::encodeToMemory(
if (targetType->isDynamicallySized() && !_copyDynamicDataInPlace)
{
// copy tail pointer (=mem_end - mem_start) to memory
solAssert(
(2 + dynPointers) <= 16,
"Stack too deep(" + to_string(2 + dynPointers) + "), try using fewer variables."
);
m_context << dupInstruction(2 + dynPointers) << Instruction::DUP2;
m_context << Instruction::SUB;
m_context << dupInstruction(2 + dynPointers - thisDynPointer);