tgockel / json-voorhees

A killer modern C++ library for interacting with JSON.
http://tgockel.github.io/json-voorhees/
Apache License 2.0
128 stars 18 forks source link

Parser ignores stray slashes #49

Closed sth closed 9 years ago

sth commented 9 years ago

A single slash is interpreted as the potential start of a comment and is ignored even if a full comment couldn't be matched. This causes "/1"_json or R"({"a": ////////"b"})"_json to be parsed without errors, while they aren't valid json.

When a slash is encountered, match_pattern() is called to parse the comment, which will return match_result::unmatched. This result is then ignored in tokenizer::next() and the token will be treated as valid. The single slash will then be treated as a full, valid comment.

The unmatched result should result in a parse error instead.