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

Fix unsafe check for BSONElement conversion from double to int

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 5.1.1
    • None
    • None
    • Fully Compatible
    • ALL
    • QE 2021-11-29, QE 2021-12-13
    • 130

    Description

      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.

      Attachments

        Activity

          People

            rui.liu@mongodb.com Rui Liu
            justin.seyster@mongodb.com Justin Seyster
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: