aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-11-10 18:33:15 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-12-01 00:41:38 +0800
commit03ccc6df704aae4ea19698f0167798013c14536e (patch)
treee28cbda500c4f707a2ca46be03c27eec773d7de6
parentb16cdbb57e2f3bdc99b2cf367e40a7f78b4c72ee (diff)
downloaddexon-solidity-03ccc6df704aae4ea19698f0167798013c14536e.tar.gz
dexon-solidity-03ccc6df704aae4ea19698f0167798013c14536e.tar.zst
dexon-solidity-03ccc6df704aae4ea19698f0167798013c14536e.zip
codegen: truncate a boolean calldata down to one bit
-rw-r--r--Changelog.md1
-rw-r--r--libsolidity/codegen/CompilerUtils.cpp2
2 files changed, 3 insertions, 0 deletions
diff --git a/Changelog.md b/Changelog.md
index b5e48173..86e0125a 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -5,6 +5,7 @@ Features:
Bugfixes:
* Type checker: string literals that are not valid UTF-8 cannot be converted to string type
+ * Code generator: higher bits in a boolean argument are ignored.
### 0.4.6 (2016-11-22)
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp
index d5361ac6..ff0f8b9c 100644
--- a/libsolidity/codegen/CompilerUtils.cpp
+++ b/libsolidity/codegen/CompilerUtils.cpp
@@ -925,6 +925,8 @@ unsigned CompilerUtils::loadFromMemoryHelper(Type const& _type, bool _fromCallda
if (leftAligned)
m_context << shiftFactor << Instruction::MUL;
}
+ if (_fromCalldata && _type.category() == Type::Category::Bool)
+ m_context << Instruction::ISZERO << Instruction::ISZERO;
return numBytes;
}