From 4134834ff3adedcf31d73edf5d25bfdc57994289 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 1 Sep 2016 19:31:17 +0200 Subject: Guard encoding crashes with assertions. --- libsolidity/codegen/CompilerUtils.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libsolidity') diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index d7d17b8e..c02a8126 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -160,7 +160,15 @@ void CompilerUtils::encodeToMemory( TypePointers targetTypes = _targetTypes.empty() ? _givenTypes : _targetTypes; solAssert(targetTypes.size() == _givenTypes.size(), ""); for (TypePointer& t: targetTypes) + { + solAssert( + t->mobileType() && + t->mobileType()->interfaceType(_encodeAsLibraryTypes) && + t->mobileType()->interfaceType(_encodeAsLibraryTypes)->encodingType(), + "Encoding type " + t->toString() + " not yet implemented." + ); t = t->mobileType()->interfaceType(_encodeAsLibraryTypes)->encodingType(); + } // Stack during operation: // ... ... -- cgit v1.2.3 From bf3f45c948b8c30dffcf19cf4bb1fcf3a74d8252 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 5 Sep 2016 17:11:23 +0200 Subject: Improve error message. --- libsolidity/codegen/CompilerUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libsolidity') diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index c02a8126..ec496df8 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -165,7 +165,7 @@ void CompilerUtils::encodeToMemory( t->mobileType() && t->mobileType()->interfaceType(_encodeAsLibraryTypes) && t->mobileType()->interfaceType(_encodeAsLibraryTypes)->encodingType(), - "Encoding type " + t->toString() + " not yet implemented." + "Encoding type \"" + t->toString() + "\" not yet implemented." ); t = t->mobileType()->interfaceType(_encodeAsLibraryTypes)->encodingType(); } -- cgit v1.2.3