[CDRIVER-804] Use int64_t for timeouts consistently Created: 12/Aug/15  Updated: 03/May/17  Resolved: 14/Aug/15

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

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

There are a number of places that timeouts are handled as signed 32-bit millisecond values. This invites overflows if the timeout is over 36 minutes:

/* 36 minutes */
int32_t timeout_msec = 2160000;
/* overflow */
int64_t expire_at = bson_get_time_monotonic () + timeout_msec * 1000;

This particular bug can be fixed with:

int64_t expire_at = bson_get_time_monotonic () + (int64_t) timeout_msec * 1000;

... until the next time we make the same mistake.

Change all timeout_msec values to int64_t.



 Comments   
Comment by Githook User [ 14/Aug/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-804 use BSON_ASSERT, not assert
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/610c4a844952c87d3b2dc6b62fd6552bae2fce01

Comment by Githook User [ 14/Aug/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-804 32-bit overflows in timeouts

Stopgap until all timeout arguments are upgraded to int64_t.
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/75f48068e9ec547ccad48453dacc4d60985f827e

Comment by A. Jesse Jiryu Davis [ 13/Aug/15 ]

Can't be completely fixed this sprint, but we can make progress.

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