aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityNatspecJSON.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-01-12 22:29:44 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-01-12 22:29:44 +0800
commitf729e862e9490752aeccf5ef218b3d381c1b5738 (patch)
treeeb00be370840ae4e79ef9751c9640c6db470fc28 /SolidityNatspecJSON.cpp
parentc8b33fb7099716fa3a93df4ae86c746d04eb2533 (diff)
downloaddexon-solidity-f729e862e9490752aeccf5ef218b3d381c1b5738.tar
dexon-solidity-f729e862e9490752aeccf5ef218b3d381c1b5738.tar.gz
dexon-solidity-f729e862e9490752aeccf5ef218b3d381c1b5738.tar.bz2
dexon-solidity-f729e862e9490752aeccf5ef218b3d381c1b5738.tar.lz
dexon-solidity-f729e862e9490752aeccf5ef218b3d381c1b5738.tar.xz
dexon-solidity-f729e862e9490752aeccf5ef218b3d381c1b5738.tar.zst
dexon-solidity-f729e862e9490752aeccf5ef218b3d381c1b5738.zip
Fixing bug where empty tagless docstring in Natspec would result in infinite loop
Diffstat (limited to 'SolidityNatspecJSON.cpp')
-rw-r--r--SolidityNatspecJSON.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/SolidityNatspecJSON.cpp b/SolidityNatspecJSON.cpp
index f6a33247..7edb97a7 100644
--- a/SolidityNatspecJSON.cpp
+++ b/SolidityNatspecJSON.cpp
@@ -510,6 +510,19 @@ BOOST_AUTO_TEST_CASE(dev_title_at_function_error)
BOOST_CHECK_THROW(checkNatspec(sourceCode, natspec, false), DocstringParsingError);
}
+// test for bug where having no tags in docstring would cause infinite loop
+BOOST_AUTO_TEST_CASE(natspec_no_tags)
+{
+ char const* sourceCode = "contract test {\n"
+ " /// I do something awesome\n"
+ " function mul(uint a, uint second) returns(uint d) { return a * 7 + second; }\n"
+ "}\n";
+
+ char const* natspec = "{\"methods\": {}}";
+
+ checkNatspec(sourceCode, natspec, false);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}