Undefined behavior from signed overflow in cursor manager, can result in mongos invariant failure

XMLWordPrintableJSON

    • Fully Compatible
    • ALL
    • v4.0, v3.6
    • Query 2018-10-08
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      david.storch pointed this out while we were reading some code at my desk:

      The call to std::abs(_pseudoRandom.nextInt32()) here could result in undefined behavior if _pseudoRandom.nextInt32() returns MIN_INT. Most compilers will probably do something reasonable in this situation. Many will probably just return MIN_INT, meaning that it's possible to get a negative cursor id.

              Assignee:
              Ted Tuckman
              Reporter:
              Ian Boros
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: