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

Reorder invariant in sbe pushStack to avoid undefined behaviour

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 8.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • QE 2025-03-31
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      Following this comment, we should re-order the condition check and the actual pointer subtraction to avoid Undefined Behaviour:
      "The out of bounds localPtr has already been created by incrementing _argStackTop, and it's UB. It looks like we form these invalid pointers and THEN we check to see if doing so was UB. An optimizer can conceivably mess with you here and give you a bad localPtr value that will pass the invariant."

            Assignee:
            victorfilip.ghita@mongodb.com Victor Ghita
            Reporter:
            victorfilip.ghita@mongodb.com Victor Ghita
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: