You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Seth Falcon (JIRA)" <ji...@apache.org> on 2011/01/20 01:31:44 UTC

[jira] Commented: (COUCHDB-1031) Able to PUT a JSON document containing invalid UTF-8 characters

    [ https://issues.apache.org/jira/browse/COUCHDB-1031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12983953#action_12983953 ] 

Seth Falcon commented on COUCHDB-1031:
--------------------------------------

You can manufacture bad json documents via Ruby as follows:

Create a gzip of a text file, foo.gz.
In irb do:

require 'json'
h = { "stuff" => IO.read("foo.gz")}
open("foo.json", "w") { |f| f.write(h) }



> Able to PUT a JSON document containing invalid UTF-8 characters
> ---------------------------------------------------------------
>
>                 Key: COUCHDB-1031
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1031
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.0.1
>            Reporter: Seth Falcon
>         Attachments: bad.json, smallbad.json
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> It is possible to create a document (via curl) containing invalid UTF-8.  The document is created, but cannot be retrieved.
> I will attach an example bad JSON file to this ticket.  The repro steps are as follows:
> couchdb - Apache CouchDB 1.0.1 (from homebrew on OSX)
> Erlang 14B
> curl -is -X PUT http://localhost:5984/bad-json/bad --data-binary @bad.json 
> HTTP/1.1 100 Continue
> HTTP/1.1 201 Created
> Server: CouchDB/1.0.1 (Erlang OTP/R14B)
> Location: http://localhost:5984/bad-json/bad
> Etag: "1-0167e886a8795380afc0d3de8922a576"
> Date: Thu, 20 Jan 2011 00:16:21 GMT
> Content-Type: text/plain;charset=utf-8
> Content-Length: 66
> Cache-Control: must-revalidate
> {"ok":true,"id":"bad","rev":"1-0167e886a8795380afc0d3de8922a576"}
> curl -is http://localhost:5984/bad-json/bad
> HTTP/1.1 500 Internal Server Error
> Server: CouchDB/1.0.1 (Erlang OTP/R14B)
> Date: Thu, 20 Jan 2011 00:16:57 GMT
> Content-Type: text/plain;charset=utf-8
> Content-Length: 53
> Cache-Control: must-revalidate
> {"error":"ucs","reason":"{bad_utf8_character_code}"}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.