Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2851

Coverity analysis defect 105074: Unintentional integer overflow

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.14.0
    • Affects Version/s: None
    • Component/s: None
    • None

      An integer overflow occurs, with the result converted to a wider integer type

      Defect 105074 (STATIC_C)
      Checker OVERFLOW_BEFORE_WIDEN (subcategory none)
      File: /src/libmongoc/src/mongoc/mongoc-gridfs-bucket-file.c
      Function _mongoc_gridfs_bucket_file_save
      /src/libmongoc/src/mongoc/mongoc-gridfs-bucket-file.c, line: 549
      Potentially overflowing expression "file->curr_chunk * file->chunk_size" with type "int" (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "int64_t" (64 bits, signed).

             length = file->curr_chunk * file->chunk_size;
      

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: