From 8e11bac8dee78f0133dd1a06644dc8b55123c58c Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Thu, 13 Oct 2016 20:17:13 +0200 Subject: [PATCH] Check if a fixedBytes fits an integer type before looking up the size of the integer type. Fixes #1150. --- libsolidity/ast/Types.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 6d1af5345..edb0fbe44 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -574,7 +574,11 @@ bool RationalNumberType::isImplicitlyConvertibleTo(Type const& _convertTo) const { FixedBytesType const& fixedBytes = dynamic_cast(_convertTo); if (!isFractional()) - return fixedBytes.numBytes() * 8 >= integerType()->numBits(); + { + if (integerType()) + return fixedBytes.numBytes() * 8 >= integerType()->numBits(); + return false; + } else return false; }