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

Fix undefined argument order for $atan2 in SBE

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.4, 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v6.1, v6.0
    • QE 2022-10-31

      In SBE implementation for atan2 we extract arguments for atan2 in undefined order because _context->popExpr() is called several times as function argument:
      https://github.com/mongodb/mongo/blob/424befe581c9aeb29e42f05c0b1439ba2e39af98/src/mongo/db/query/sbe_stage_builder_expression.cpp#L3481

      C++ doesn't specify the order of computation for function argument, so with any compiler upgrader and/or change in compilation flags this function can break.

            Assignee:
            adi.agrawal@mongodb.com Adi Agrawal
            Reporter:
            ivan.fefer@mongodb.com Ivan Fefer
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: