Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-246

mongo::fromjson / JParse misparses JSON on locales that use a comma as decimal separator

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None

    Description

      mongo::fromjson can't parse this simple json on a linux system with locale setting LC_NUMERIC=de_DE.UTF-8:

      {
          "test1": 1,
          "test2": 1
      }

      parsing fails with the following error message:

      terminate called after throwing an instance of 'mongo::MsgAssertionException'
        what():  code FailedToParse: FailedToParse: Expecting '}' or ',': offset:17 of:{
          "test1": 1,
          "test2": 1
      }

      Then the doSaslX functions 

      This error is caused by JParse::number's usage of strtod which may be locale specific and in that cause don't parse according to the json syntax but by some other rules.

      The code already points to SERVER-11920 in comments.

      This is with the most recent commit on the legacy branch (2e86826)

      Attachments

        Activity

          People

            Unassigned Unassigned
            mhostettler Martin Hostettler
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: