aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2016-08-06 01:27:44 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2016-08-09 02:57:41 +0800
commite8c2e87397c0dbb8e5be3e096385e45740a4cbf3 (patch)
tree33b0a77171ac3e11addba30728067f7756364ec6 /libsolidity/ast
parent7945f41ccc63510a3fcb68d7c00e0c48143c4ed3 (diff)
downloaddexon-solidity-e8c2e87397c0dbb8e5be3e096385e45740a4cbf3.tar.gz
dexon-solidity-e8c2e87397c0dbb8e5be3e096385e45740a4cbf3.tar.zst
dexon-solidity-e8c2e87397c0dbb8e5be3e096385e45740a4cbf3.zip
Use utf8::validate in StringLiteral::toString
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/Types.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index df4ec0aa..d6f6225c 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -26,6 +26,7 @@
#include <libdevcore/CommonIO.h>
#include <libdevcore/CommonData.h>
#include <libdevcore/SHA3.h>
+#include <libdevcore/UTF8.h>
#include <libsolidity/interface/Utils.h>
#include <libsolidity/ast/AST.h>
@@ -854,6 +855,11 @@ bool StringLiteralType::operator==(const Type& _other) const
std::string StringLiteralType::toString(bool) const
{
+ int invalidSequence;
+
+ if (!dev::utf8::validate(m_value, invalidSequence))
+ return "literal_string (contains invalid UTF-8 sequence at position " + dev::toString(invalidSequence) + ")";
+
return "literal_string \"" + m_value + "\"";
}