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

ShardKeyPattern::parseShardKeyPattern() - NaN representation is being cast to integer

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 5.0.4, 5.1.0-rc0
    • None
    • None
    • Fully Compatible
    • ALL
    • v5.0
    • Execution Team 2021-06-14
    • 43

    Description

      On bsonelement.h an unsafe cast is being done that could end up in a situation where NaN (which representation according to the EcmaScript specification is 9007199254740990) is being casted to an integer, the following example can cause such situation:

      let st = new ShardingTest({mongos:1, shards:1});
      st.s.adminCommand({enableSharding: 'db'});
      st.s.adminCommand({shardCollection: 'db.test', key: { _id: NaN }});
      

      Here when passing the index we end up trying to get the number which does the cast. This causes failures on the fuzzer tests as can be seeing in the linked BF.

      Attachments

        Activity

          People

            benety.goh@mongodb.com Benety Goh
            marcos.grillo@mongodb.com Marcos José Grillo Ramirez
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: