ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: python-bsonjs
    • None
    • Python Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Detailed steps to reproduce the problem?

      In bsonjs/bsonjs.c's dumps(), json_len is declared size_t (matching libbson's bson_as*_extended_json output-length parameters) but is passed to Py_BuildValue("s#", json, json_len). bsonjs.h defines PY_SSIZE_T_CLEAN before including Python.h, so the "s#" format code reads a Py_ssize_t out of the varargs list, not a size_t. This happens to work on today's common 64-bit platforms where the two types are the same width, but is reading the wrong type out of the varargs list. load()/loads() on the read side already use Py_ssize_t correctly.

      Definition of done: what must be done to consider the task complete?

      Cast json_len to Py_ssize_t at the Py_BuildValue call site. Fix already up: mongodb-labs/python-bsonjs#114.

      The exact Python version used, with patch level:

      N/A — latent on any platform where size_t and Py_ssize_t differ in width; harmless today on common 64-bit platforms.

      The exact version of PyMongo used, with patch level:

      N/A — not a PyMongo dependency; found via code review.

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      N/A

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      N/A

      Web framework or asynchronous network library used, if any, with version (e.g. Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)

      N/A

      Security Vulnerabilities

      If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here

            Assignee:
            Steve Silvester
            Reporter:
            Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: