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

Undefined behaviour in the ServerStatusSection constructor

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.7
    • Affects Version/s: 3.5.6
    • Component/s: Internal Code
    • None
    • Fully Compatible
    • ALL
    • Platforms 2017-05-08
    • 0

      The constructor for ServerStatusSection calls a non-static method on the CmdServerStatus class. Depending on the order of construction of the different sections, this invocation may happen before CmdServerStatus has been constructed.

      This was discovered through UBSAN:

      src/mongo/db/commands/server_status.cpp:196:21: runtime error: member call on address 0x55555cfde1d8 which does not point to an object of type 'mongo::CmdServerStatus'
      0x55555cfde1d8: note: object has invalid vptr
       00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
                    ^~~~~~~~~~~~~~~~~~~~~~~
                    invalid vptr
      

      Since CmdServerStatus::_sections is static it doesn't need to be accessed through a non-static function.

            Assignee:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: