[SERVER-22706] key_string_test forms invalid integer negation Created: 17/Feb/16  Updated: 26/Apr/16  Resolved: 15/Apr/16

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: None
Fix Version/s: 3.3.5

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

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Run key_string_test under UBSAN

Sprint: Platforms 13 (04/22/16)
Participants:

 Description   

See https://github.com/mongodb/mongo/blob/bd2c33b3c6000b92aa42bd285654d8e27bcd3af7/src/mongo/db/storage/key_string_test.cpp#L246

This results in the following error under UBSAN:

rc/mongo/db/storage/key_string_test.cpp:246:9: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
    #0 0x59d660 in UnitTest__KeyStringTest__LotsOfNumbers1::_doTest() /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/db/storage/key_string_test.cpp:246:9
    #1 0x61c208 in mongo::unittest::Test::run() /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.cpp:147:9
    #2 0x5c5933 in void mongo::unittest::Suite::runTestObject<UnitTest__KeyStringTest__LotsOfNumbers1>() /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.h:405:9
    #3 0x61d99d in mongo::unittest::TestHolder::run() const /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.h:257:9
    #4 0x61d99d in mongo::unittest::Suite::run(std::string const&, int) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.cpp:263
    #5 0x61ee67 in mongo::unittest::Suite::run(std::vector<std::string, std::allocator<std::string> > const&, std::string const&, int) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.cpp:321:27
    #6 0x6244a7 in main /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest_main.cpp:40:12
    #7 0x7faa2b62ba3f in __libc_start_main /build/buildd/glibc-2.21/csu/libc-start.c:289
    #8 0x56b9e8 in _start (/home/andrew/Documents/10gen/dev/src/mongodb/build/optdebug/mongo/db/storage/storage_key_string_test+0x56b9e8)



 Comments   
Comment by Githook User [ 15/Apr/16 ]

Author:

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

Message: SERVER-16221 SERVER-22706 Don't negate integral minima in KeyString test
Branch: master
https://github.com/mongodb/mongo/commit/0656cf72fe049204a1cc13991953cd7682411792

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