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

Coverity analysis defect 122032: Division or modulo by zero

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Sharding EMEA
    • ALL

      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:103: DIVIDE_BY_ZERO 122032 Assigning: "numRecords" = "autoColl->numRecords(opCtx)". The value of "numRecords" is now 0.
      /src/mongo/db/s/shardsvr_get_stats_for_balancing_command.cpp:122: DIVIDE_BY_ZERO 122032 In expression "dataSizeBytes / numRecords", division by expression "numRecords" which may be zero has undefined behavior.

            Assignee:
            backlog-server-sharding-emea [DO NOT USE] Backlog - Sharding EMEA
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: