BIND 10 #1072: Element::fromJSON accepts "{" (a single opening curly brace)
BIND 10 Development
do-not-reply at isc.org
Wed Jun 29 07:33:54 UTC 2011
#1072: Element::fromJSON accepts "{" (a single opening curly brace)
-------------------------------------+-------------------------------------
Reporter: jinmei | Owner:
Type: defect | Status: new
Priority: major | Milestone: New
Component: | Tasks
configuration | Keywords:
Sensitive: 0 | Defect Severity: N/A
Sub-Project: Core | Feature Depending on Ticket:
Estimated Difficulty: 0 | Add Hours to Ticket: 0
Total Hours: 0 | Internal?: 0
-------------------------------------+-------------------------------------
try the following test
{{{
diff --git a/src/lib/cc/tests/data_unittests.cc
b/src/lib/cc/tests/data_unittests.cc
index 2536682..be50224 100644
--- a/src/lib/cc/tests/data_unittests.cc
+++ b/src/lib/cc/tests/data_unittests.cc
@@ -396,6 +396,7 @@ TEST(Element, to_and_from_wire) {
EXPECT_EQ("1", Element::fromWire(ss, 1)->str());
// Some malformed JSON input
+ EXPECT_THROW(Element::fromJSON("{"), isc::data::JSONError);
EXPECT_THROW(Element::fromJSON("{\":"), isc::data::JSONError);
EXPECT_THROW(Element::fromJSON("]"), isc::data::JSONError);
EXPECT_THROW(Element::fromJSON("[ 1, 2, }"), isc::data::JSONError);
}}}
It fails because the added line doesn't throw. But if you change
{ to [, it succeeds (it throws JSONError).
I suspect it's a bug.
--
Ticket URL: <http://bind10.isc.org/ticket/1072>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list