Coverity analysis defect 122032: Division or modulo by zero

XMLWordPrintableJSON

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

      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:
              [DO NOT USE] Backlog - Sharding EMEA
              Reporter:
              Coverity Collector User
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: