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

Fix unsafe check for BSONElement conversion from double to int

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

      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@mongodb.com Rui Liu
            Reporter:
            justin.seyster@mongodb.com Justin Seyster
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: