Skip to content

Commit e037858

Browse files
garethsbBillyONeal
authored andcommitted
json: {"meow"} is not a valid object (microsoft#1130)
* json: {"meow"} is not a valid object * Add to contributors - eighteenth PR seemed like the time! :-)
1 parent 7536ae5 commit e037858

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CONTRIBUTORS.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ leetal
5454

5555
Benjamin Lee (mobileben)
5656
René Meusel (reneme)
57+
58+
Sony Corporation
59+
Gareth Sylvester-Bradley (garethsb-sony)

Release/src/json/json_parsing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ std::unique_ptr<web::json::details::_Value> JSON_Parser<CharType>::_ParseObject(
965965
if (tkn.m_error) goto error;
966966

967967
// State 2: Looking for a colon.
968-
if (tkn.kind != JSON_Parser<CharType>::Token::TKN_Colon) goto done;
968+
if (tkn.kind != JSON_Parser<CharType>::Token::TKN_Colon) goto error;
969969

970970
GetNextToken(tkn);
971971
if (tkn.m_error) goto error;

Release/tests/functional/json/parsing_tests.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,12 @@ SUITE(parsing_tests)
469469
VERIFY_ARE_EQUAL(0u, arr.size());
470470
}
471471

472+
TEST(bug_object_field_key_no_value)
473+
{
474+
VERIFY_PARSING_THROW(json::value::parse(U("{\"meow\"}")));
475+
VERIFY_PARSING_THROW(json::value::parse(U("{\"meow\": 42, \"purr\": 57, \"hiss\"}")));
476+
}
477+
472478
TEST(bug_416116)
473479
{
474480
json::value data2 = json::value::parse(U("\"δοκιμή\""));

0 commit comments

Comments
 (0)