[CDRIVER-2851] Coverity analysis defect 105074: Unintentional integer overflow Created: 11/Oct/18  Updated: 28/Oct/23  Resolved: 23/Oct/18

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.14.0

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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;



 Comments   
Comment by Githook User [ 23/Oct/18 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@10gen.com', 'username': 'kevinAlbs'}

Message: CDRIVER-2851 fix coverity overflow warning
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/f0d23c435afea45d382c3cb9090e36ccfdf9e3be

Generated at Wed Feb 07 21:16:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.