[SERVER-10490] SafeNum int32/int32 and int64/int64 internal addition routines rely on undefined behavior Created: 12/Aug/13  Updated: 11/Jul/16  Resolved: 20/Aug/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 2.5.2

Type: Bug Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

In safe_num.cpp, the addInt32Int32 and addInt64Int64 routines incorrectly assume meaningful outcomes from signed integer overflow, which is actually undefined behavior.



 Comments   
Comment by auto [ 20/Aug/13 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}

Message: SERVER-10490 SERVER-375 Add static assertions for overflow safe algos
Branch: master
https://github.com/mongodb/mongo/commit/4a6f0941c13ac6a197bb787e238ddbc12120b641

Comment by auto [ 20/Aug/13 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}

Message: SERVER-10490 Use pre and post conditions to avoid signed integer overflow in SafeNum addition
Branch: master
https://github.com/mongodb/mongo/commit/a8eab606724de2d23a6cafd069f4001a031ed909

Generated at Thu Feb 08 03:23:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.