[ruby-core:78194] [Ruby trunk Bug#12951][Third Party's Issue] JSON.parse allows invalid string escapes
From:
shyouhei@...
Date:
2016-11-18 07:20:50 UTC
List:
ruby-core #78194
Issue #12951 has been updated by Shyouhei Urabe.
Status changed from Open to Third Party's Issue
It is a very delicate question if this is a bug. According to RFC7159 section 9 https://tools.ietf.org/html/rfc7159#section-9, a JSON parser is explicitly allowed to extend JSON. So this could perhaps be an extension made by the JSON parser.
Besides that JSON is maintained in a separate repo so please report there https://github.com/flori/json
----------------------------------------
Bug #12951: JSON.parse allows invalid string escapes
https://bugs.ruby-lang.org/issues/12951#change-61563
* Author: Matthew Boedicker
* Status: Third Party's Issue
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
According to jq and jsonlint, the following JSON is invalid:
~~~
{"x":"\$"}
~~~
but JSON.parse will parse it without complaint:
~~~
irb(main):002:0> JSON.parse('{"x":"\$"}')
=> {"x"=>"$"}
~~~
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>