Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-7324

Inappropriate use of toHex( &number, 4 ) to display value in hex

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.5.2
    • Affects Version/s: 2.0.7, 2.2.0
    • Component/s: Logging, Usability
    • Fully Compatible
    • ALL
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      There are some places in the code where we use the toHex() routine to display a number in hexadecimal. This function doesn't do that; it displays a sequence of hexadecimal digits representing the contents of a memory location, in the order that they occur in memory. This means that on little-endian machines (i.e. all machines that MongoDB runs on in shipping branches) all of these values are byte-swapped relative to the actual value represented in hexadecimal.

      Assertion: 10334:BSONObj size: -2 (0xFEFFFFFF) is invalid. Size must be between 0 and 16793600(16MB)
      

      This should display as:

      Assertion: 10334:BSONObj size: -2 (0xFFFFFFFE) is invalid. Size must be between 0 and 16793600(16MB)
      

      We should add a function for converting values to hexadecimal display strings and call it instead of toHex() when displaying numeric values.

            Assignee:
            andrew.emil@10gen.com Andrew Emil (Inactive)
            Reporter:
            tad Tad Marshall
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: