From a35f91816b410a51c8d2759a90a67605b3f3b5b0 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 16 Nov 2015 17:09:09 +0100 Subject: Fix dynamic indexed event arguments - applies sha3. --- libsolidity/codegen/ExpressionCompiler.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'libsolidity/codegen/ExpressionCompiler.cpp') diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 3774e731..3906a897 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -587,11 +587,24 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) { ++numIndexed; arguments[arg - 1]->accept(*this); - utils().convertType( - *arguments[arg - 1]->annotation().type, - *function.parameterTypes()[arg - 1], - true - ); + if (auto const& arrayType = dynamic_pointer_cast(function.parameterTypes()[arg - 1])) + { + utils().fetchFreeMemoryPointer(); + utils().encodeToMemory( + {arguments[arg - 1]->annotation().type}, + {arrayType}, + false, + true + ); + utils().toSizeAfterFreeMemoryPointer(); + m_context << eth::Instruction::SHA3; + } + else + utils().convertType( + *arguments[arg - 1]->annotation().type, + *function.parameterTypes()[arg - 1], + true + ); } if (!event.isAnonymous()) { -- cgit