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

Coverity analysis defect 122087: Division or modulo by zero

    • Fully Compatible
    • ALL
    • v6.0
    • Sharding EMEA 2022-05-02

      Division or modulo by zero

      The program will have undefined behavior, likely a crash. Division or modulo by zero results in undefined behavior.
      /src/mongo/db/s/shardsvr_get_stats_for_balancing_command.cpp:111: DIVIDE_BY_ZERO 122087 Assigning: "numRecords" = "autoColl->numRecords(opCtx)". The value of "numRecords" is now 0.
      /src/mongo/db/s/shardsvr_get_stats_for_balancing_command.cpp:130: DIVIDE_BY_ZERO 122087 In expression "dataSizeBytes / numRecords", division by expression "numRecords" which may be zero has undefined behavior.

            Assignee:
            tommaso.tocci@mongodb.com Tommaso Tocci
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: