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

Coverity analysis defect 162784: Overflowed integer argument

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Networking & Observability
    • ALL
    • Networking & Obs 2025-01-20

      Overflowed integer argument

      The argument will be too small or even negative, likely resulting in unexpected behavior (for example, under-allocation in a memory allocation function). An integer overflow occurs, with the overflowed value used as an argument to a function
      /data/bazel_cache/1de52aaeb35278243ca29a4785ce7969/execroot/_main_/src/mongo/db/traffic_reader.cpp:98: INTEGER_OVERFLOW 162784 Called function "read(fd, buf, toRead)", and a possible return value may be less than zero.
      /data/bazel_cache/1de52aaeb35278243ca29a4785ce7969/execroot/_main_/src/mongo/db/traffic_reader.cpp:98: INTEGER_OVERFLOW 162784 Assigning: "r" = "read(fd, buf, toRead)".
      /data/bazel_cache/1de52aaeb35278243ca29a4785ce7969/execroot/_main_/src/mongo/db/traffic_reader.cpp:114: INTEGER_OVERFLOW 162784 The expression "toRead -= r" might be negative, but is used in a context that treats it as unsigned.
      /data/bazel_cache/1de52aaeb35278243ca29a4785ce7969/execroot/_main_/src/mongo/db/traffic_reader.cpp:98: INTEGER_OVERFLOW 162784 "toRead", which might be negative, is passed to "read(fd, buf, toRead)".

            Assignee:
            joseph.prince@mongodb.com Joseph Prince
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: