[SERVER-38445] Date_t and Duration addition can overflow Created: 06/Dec/18  Updated: 29/Oct/23  Resolved: 07/Dec/18

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 4.0.6, 4.1.7

Type: Task Priority: Major - P3
Reporter: Matthew Saltz (Inactive) Assignee: Matthew Saltz (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.0
Sprint: Sharding 2018-12-17
Participants:

 Description   

The following code leads to a silent overflow:

auto badDate = Date_t::max() + Milliseconds(1);

This should throw an exception instead.



 Comments   
Comment by Githook User [ 11/Jan/19 ]

Author:

{'username': 'saltzm', 'email': 'matthew.saltz@mongodb.com', 'name': 'Matthew Saltz'}

Message: SERVER-38445 Fix Date_t addition with Duration

(cherry picked from commit d899a205ef66d916b071dd42fbb619775561a523)
Branch: v4.0
https://github.com/mongodb/mongo/commit/c48f6c22e5a8013bbcd6e08cb489b1e809dbbfed

Comment by Githook User [ 07/Dec/18 ]

Author:

{'name': 'Matthew Saltz', 'email': 'matthew.saltz@mongodb.com', 'username': 'saltzm'}

Message: SERVER-38445 Fix Date_t addition with Duration
Branch: master
https://github.com/mongodb/mongo/commit/d899a205ef66d916b071dd42fbb619775561a523

Generated at Thu Feb 08 04:48:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.