aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-10-24 21:19:13 +0800
committerGitHub <noreply@github.com>2016-10-24 21:19:13 +0800
commit2f1310124308cba97e5b14c3f4a089a435320582 (patch)
tree00ce51ea0dc0c27739bd8a9d5d92ac3a51cfe372
parentcb1fcaf6f65608d6528753f1a998c2cf9f67baab (diff)
parent57ee3877552372f120de688074451e9b6784d63b (diff)
downloaddexon-solidity-2f1310124308cba97e5b14c3f4a089a435320582.tar.gz
dexon-solidity-2f1310124308cba97e5b14c3f4a089a435320582.tar.zst
dexon-solidity-2f1310124308cba97e5b14c3f4a089a435320582.zip
Merge pull request #1251 from ethereum/fixthrow
Fix crash in throw.
-rw-r--r--Changelog.md12
-rw-r--r--libsolidity/ast/Types.cpp2
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp12
3 files changed, 19 insertions, 7 deletions
diff --git a/Changelog.md b/Changelog.md
index a6a2f2dd..44f3183b 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -9,17 +9,17 @@ Features:
* Support shifting constant numbers.
Bugfixes:
- * Optimizer: fix related to stale knowledge about SHA3 operations
- * Disallow unknown options in ``solc``.
- * Proper type checking for bound functions.
- * Type Checker: ``super.x`` does not look up ``x`` in the current contract.
- * Code Generator: expect zero stack increase after `super` as an expression.
- * Allow inheritance of ``enum`` definitions.
+ * Commandline interface: Disallow unknown options in ``solc``.
+ * Name resolver: Allow inheritance of ``enum`` definitions.
+ * Type checker: Proper type checking for bound functions.
+ * Type checker: fix crash related to invalid fixed point constants
+ * Code generator: expect zero stack increase after ``super`` as an expression.
* Inline assembly: support the ``address`` opcode.
* Inline assembly: fix parsing of assignment after a label.
* Inline assembly: external variables of unsupported type (such as ``this``, ``super``, etc.)
are properly detected as unusable.
* Inline assembly: support variables within modifiers.
+ * Optimizer: fix related to stale knowledge about SHA3 operations
### 0.4.2 (2016-09-17)
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index a412d421..88bdee9f 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -483,7 +483,7 @@ tuple<bool, rational> RationalNumberType::isValidLiteral(Literal const& _literal
!all_of(radixPoint + 1, _literal.value().end(), ::isdigit) ||
!all_of(_literal.value().begin(), radixPoint, ::isdigit)
)
- throw;
+ return make_tuple(false, rational(0));
//Only decimal notation allowed here, leading zeros would switch to octal.
auto fractionalBegin = find_if_not(
radixPoint + 1,
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index f024c03e..44ac1511 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -4088,6 +4088,18 @@ BOOST_AUTO_TEST_CASE(using_directive_for_missing_selftype)
BOOST_CHECK(expectError(text, false) == Error::Type::TypeError);
}
+BOOST_AUTO_TEST_CASE(invalid_fixed_point_literal)
+{
+ char const* text = R"(
+ contract A {
+ function a() {
+ .8E0;
+ }
+ }
+ )";
+ BOOST_CHECK(expectError(text, false) == Error::Type::TypeError);
+}
+
BOOST_AUTO_TEST_CASE(shift_constant_left_negative_rvalue)
{
char const* text = R"(