-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Internal Code
-
Fully Compatible
-
ALL
-
-
Platforms 13 (04/22/16)
Static casting a random integer to an enum value that isn't in the enum is undefined behavior. See https://github.com/mongodb/mongo/blob/742f15bfcf2173103498a81f56503c9746b4e93d/src/mongo/util/fail_point_test.cpp#L148-L152
src/mongo/util/fail_point.cpp:107:5: runtime error: load of value 9999, which is not a valid value for type 'mongo::FailPoint::Mode' #0 0x5f06b9 in mongo::FailPoint::setMode(mongo::FailPoint::Mode, unsigned int, mongo::BSONObj const&) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/util/fail_point.cpp:107:5 #1 0x582abd in mongo_test::UnitTest__FailPoint__SetInvalidMode::_doTest() /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/util/fail_point_test.cpp:148:5 #2 0x5def78 in mongo::unittest::Test::run() /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.cpp:147:9 #3 0x589b73 in void mongo::unittest::Suite::runTestObject<mongo_test::UnitTest__FailPoint__SetInvalidMode>() /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.h:405:9 #4 0x5e070d in mongo::unittest::TestHolder::run() const /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.h:257:9 #5 0x5e070d in mongo::unittest::Suite::run(std::string const&, int) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.cpp:263 #6 0x5e1bd7 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 #7 0x5e72f7 in main /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest_main.cpp:40:12 #8 0x7f6808266a3f in __libc_start_main /build/buildd/glibc-2.21/csu/libc-start.c:289 #9 0x568b48 in _start (/home/andrew/Documents/10gen/dev/src/mongodb/build/optdebug/mongo/util/fail_point_test+0x568b48)