Skip to content

Resolve "UB warning caused by exceeding enum value"

Closes #3616 (closed).

  • 5aa62a53 Fix UB warning about exceeding enum value

Before:

[ RUN      ] NameDhcpv4SrvTest.emptyFqdn
option4_client_fqdn.cc:487:20: runtime error: load of value 3200171710, which is not a valid value for type 'Option4ClientFqdn::DomainNameType'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior option4_client_fqdn.cc:487:20 
option4_client_fqdn.cc:160:32: runtime error: load of value 3200171710, which is not a valid value for type 'Option4ClientFqdn::DomainNameType'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior option4_client_fqdn.cc:160:32 
[       OK ] NameDhcpv4SrvTest.emptyFqdn (26 ms)

After:

[ RUN      ] NameDhcpv4SrvTest.emptyFqdn
[       OK ] NameDhcpv4SrvTest.emptyFqdn (26 ms)
Edited by Andrei Pavel

Merge request reports