Coverity analysis defect 127492: Unintentional integer overflow

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 2.27.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Fully Compatible
    • Dotnet Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Unintentional integer overflow

      The expression's value may not be what the programmer intended, because the expression is evaluated using a narrow (i.e. few bits) integer type. An integer overflow occurs, with the result converted to a wider integer type
      /src/MongoDB.Driver.GridFS/GridFSForwardOnlyDownloadStream.cs:277: OVERFLOW_BEFORE_WIDEN 127492 Potentially overflowing expression "previousBatch.Count * this.FileInfo.ChunkSizeBytes" with type "int" (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "long" (64 bits, signed).

            Assignee:
            Oleksandr Poliakov
            Reporter:
            Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: