Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-345

"High ASCII" can be inserted into db but not retrieved

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9
    • 0.10
    • None
    • None
    • OSX 10.5.6

    Description

      It is possible to PUT/POST a document into CouchDB with a "high ASCII" value that cannot be retrieved. This results from not escaping a non-ASCII value into \u#### when PUT/POSTing the document.

      The attached sample code will recreate the problem using the hex value D8 (Ø) in a possibly unsavoury test string.
      Sample output against 0.9.0 is as follows:
      ================================================
      {
      "ok": true
      }
      {
      "id": "fail",
      "ok": true,
      "rev": "1-76726372"
      }
      {
      "error": "ucs",
      "reason": "

      {bad_utf8_character_code}

      "
      }
      ================================================

      Please note this defect turned up another problem, namely that the bad_utf8_character_code exception thrown by a design document attempting to map() the bad document caused Futon to fail silently in building the view, with no indication (except via debug log) that there was a failure. The log indicated two attempts to build the view, both failing, followed by an uncaught exception error for Futon.

      Based on this, there are likely other areas in the codebase that do not handle the bad_utf8_character_code exception correctly.

      My belief is that CouchDB shouldn't accept this input and should have rejected the PUT/POST, or should have escaped the input itself before the insertion.

      Attachments

        1. badenc1.patch
          1 kB
          Curt Arnold
        2. badtext.tar.gz
          1 kB
          Joan Touzet
        3. enctest.zip
          4 kB
          Curt Arnold
        4. reject_invalid_utf8.patch
          2 kB
          Adam Kocoloski

        Issue Links

          Activity

            People

              kocolosk Adam Kocoloski
              wohali Joan Touzet
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: