aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-09-23 23:26:17 +0800
committerchriseth <c@ethdev.com>2015-09-23 23:34:08 +0800
commit8a9b9e4fdbead915da0dd725d3dc0ffe45d84065 (patch)
tree12c9b6d06dbb2748de1c74f3933bad316804bf9a
parentc4b7916c144355dc36591fb6aad89438942b6c9a (diff)
downloaddexon-solidity-8a9b9e4fdbead915da0dd725d3dc0ffe45d84065.tar.gz
dexon-solidity-8a9b9e4fdbead915da0dd725d3dc0ffe45d84065.tar.zst
dexon-solidity-8a9b9e4fdbead915da0dd725d3dc0ffe45d84065.zip
Do not allow assignment from literal strings to storage pointers.
Fixes #90
-rw-r--r--libsolidity/Types.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp
index 68e8e91d..e24b8f06 100644
--- a/libsolidity/Types.cpp
+++ b/libsolidity/Types.cpp
@@ -511,7 +511,9 @@ bool StringLiteralType::isImplicitlyConvertibleTo(Type const& _convertTo) const
if (auto fixedBytes = dynamic_cast<FixedBytesType const*>(&_convertTo))
return size_t(fixedBytes->numBytes()) >= m_value.size();
else if (auto arrayType = dynamic_cast<ArrayType const*>(&_convertTo))
- return arrayType->isByteArray();
+ return
+ arrayType->isByteArray() &&
+ !(arrayType->dataStoredIn(DataLocation::Storage) && arrayType->isPointer());
else
return false;
}