Resolve "Fix undefined behaviors reported by UBSan"
Closes #3323 (closed).
-
d8f5291b typed enums to appease ubsan example of UBSan error: runtime error: load of value 65536, which is not a valid value for type 'const HeaderFlag'
Fixes these errors:
message.cc:408:9: runtime error: load of value 65536, which is not a valid value for type 'const HeaderFlag'
message.cc:408:23: runtime error: load of value 65536, which is not a valid value for type 'const HeaderFlag'
message.cc:409:9: runtime error: load of value 65536, which is not a valid value for type 'const HeaderFlag'
message_unittest.cc:281:5: runtime error: load of value 4, which is not a valid value for type 'const Message::Section'
message.cc:494:26: runtime error: load of value 4, which is not a valid value for type 'const Section'
message.cc:495:9: runtime error: load of value 4, which is not a valid value for type 'const Section'
message_unittest.cc:308:5: runtime error: load of value 4, which is not a valid value for type 'const Message::Section'
message.cc:510:26: runtime error: load of value 4, which is not a valid value for type 'const Section'
message.cc:511:9: runtime error: load of value 4, which is not a valid value for type 'const Section'
message_unittest.cc:334:5: runtime error: load of value 4, which is not a valid value for type 'const Message::Section'
message.cc:522:26: runtime error: load of value 4, which is not a valid value for type 'const Section'
message.cc:523:9: runtime error: load of value 4, which is not a valid value for type 'const Section'
message_unittest.cc:357:5: runtime error: load of value 4, which is not a valid value for type 'const Message::Section'
message.cc:539:22: runtime error: load of value 4, which is not a valid value for type 'const Section'
message_unittest.cc:459:5: runtime error: load of value 4, which is not a valid value for type 'const Message::Section'
message.cc:573:26: runtime error: load of value 4, which is not a valid value for type 'const Section'
message.cc:574:9: runtime error: load of value 4, which is not a valid value for type 'const Section'
message_unittest.cc:466:5: runtime error: load of value 4, which is not a valid value for type 'const Message::Section'
message.cc:1138:26: runtime error: load of value 4, which is not a valid value for type 'const Section'
message.cc:1139:9: runtime error: load of value 4, which is not a valid value for type 'const Section'
message_unittest.cc:473:5: runtime error: load of value 4, which is not a valid value for type 'const Message::Section'
message.cc:1151:26: runtime error: load of value 4, which is not a valid value for type 'const Section'
message.cc:1152:9: runtime error: load of value 4, which is not a valid value for type 'const Section'
message_unittest.cc:480:5: runtime error: load of value 4, which is not a valid value for type 'const Message::Section'
message.cc:994:26: runtime error: load of value 4, which is not a valid value for type 'const Section'
message.cc:995:9: runtime error: load of value 4, which is not a valid value for type 'const Section'
data.cc:652:13: runtime error: load of value 123, which is not a valid value for type 'Element::types'
../../../../src/lib/eval/token.h:553:47: runtime error: load of value 100, which is not a valid value for type 'const MetadataType'
token.cc:485:13: runtime error: load of value 100, which is not a valid value for type 'MetadataType'
token.cc:511:9: runtime error: load of value 100, which is not a valid value for type 'MetadataType'
../../../../src/lib/eval/token.h:608:17: runtime error: load of value 100, which is not a valid value for type 'const FieldType'
token.cc:540:17: runtime error: load of value 100, which is not a valid value for type 'FieldType'
token.cc:588:13: runtime error: load of value 100, which is not a valid value for type 'FieldType'
../../../../src/lib/eval/token.h:654:17: runtime error: load of value 100, which is not a valid value for type 'const FieldType'
token.cc:618:15: runtime error: load of value 100, which is not a valid value for type 'FieldType'
token.cc:632:11: runtime error: load of value 100, which is not a valid value for type 'FieldType'
message_unittest.cc:281:5: runtime error: load of value 4, which is not a valid value for type 'Section'
message_unittest.cc:308:5: runtime error: load of value 4, which is not a valid value for type 'Section'
message_unittest.cc:334:5: runtime error: load of value 4, which is not a valid value for type 'Section'
message_unittest.cc:357:5: runtime error: load of value 4, which is not a valid value for type 'Section'
message_unittest.cc:459:5: runtime error: load of value 4, which is not a valid value for type 'Section'
message_unittest.cc:466:5: runtime error: load of value 4, which is not a valid value for type 'Section'
message_unittest.cc:473:5: runtime error: load of value 4, which is not a valid value for type 'Section'
message_unittest.cc:480:5: runtime error: load of value 4, which is not a valid value for type 'Section'
token.cc:485:13: runtime error: load of value 100, which is not a valid value for type 'MetadataType'
token.cc:511:9: runtime error: load of value 100, which is not a valid value for type 'MetadataType'
token.cc:540:17: runtime error: load of value 100, which is not a valid value for type 'FieldType'
token.cc:588:13: runtime error: load of value 100, which is not a valid value for type 'FieldType'
token.cc:618:15: runtime error: load of value 100, which is not a valid value for type 'FieldType'
token.cc:632:11: runtime error: load of value 100, which is not a valid value for type 'FieldType'
Edited by Andrei Pavel