Fix unsafe check for BSONElement conversion from double to int

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 5.1.1
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • ALL
    • QE 2021-11-29, QE 2021-12-13
    • 130
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      This line of code is intended to implicitly convert double BSONElements to int when the conversion is exact:

      https://github.com/mongodb/mongo/blob/1bdff76322b144ef27060fe79324fe3cce4bb17a/src/mongo/db/matcher/expression_parser.cpp#L1738

       

      However, the call to `BSONElement::numberInt()` can fail when the number would overflow the int type. Additional checking is necessary to ensure that failure doesn't occur.

              Assignee:
              Rui Liu (Inactive)
              Reporter:
              Justin Seyster
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: