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

Document fassert, tighten against misuse, fix misuses

    • Server Programmability
    • Fully Compatible
    • v8.0
    • Programmability 2024-06-10

      The fassert API doesn't support supplying a message, but some existing code passes in a message as a string literal anyways (example). The effect of passing a string literal in for the assertion predicate is that the const char [] string literal undergoes implicit conversion to bool and then gets evaluated by the assertion logic. Since const char [] is always a valid pointer, the resulting bool is always true, so the fassert both loses the diagnostic information in the message and becomes a no-op.

      Fix all the places in the codebase where we fassert against a string literal and investigate ways to prevent these sorts of mistakes in the future (clang tidy check?).

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            james.bronsted@mongodb.com James Bronsted
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: