Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parser::sax_parse_internal: Avoid integer conversion warning
Clang UBSAN complains here with /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:158:20: runtime error: unsigned integer overflow: 0 - 1 cannot b e represented in type 'unsigned int' #0 0x61f497 in std::_Bit_iterator_base::_M_bump_down() /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:158:2 0 nlohmann#1 0x61b7eb in bool nlohmann::detail::parser<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer> >::sax_parse_internal<nlohmann::detail::json_sa x_dom_parser<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer> > >(nlohmann::detail::json_sax_dom_parser<nlohmann::basic_json<std::map, std::vecto r, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_ serializer> >*) /home/firma/devel/json/include/nlohmann/detail/input/json_sax.hpp nlohmann#2 0x611f33 in nlohmann::detail::parser<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std: :allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer> >::parse(bool, nlohmann::basic_json<std::map, std::v ector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann:: adl_serializer>&) /home/firma/devel/json/include/nlohmann/detail/input/parser.hpp:116:13 nlohmann#3 0x5d0522 in nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>::parse(nlohmann::detail::input_adapter&&, std::function<bool (int, nlohmann:: detail::parser<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, lon g, unsigned long, double, std::allocator, nlohmann::adl_serializer> >::parse_event_t, nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic _string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>&)>, bool)/ home/firma/devel/json/include/nlohmann/json.hpp:6160:41 nlohmann#4 0x5af340 in _DOCTEST_ANON_FUNC_84() /home/firma/devel/json/test/src/unit-msgpack.cpp:1321:19 nlohmann#5 0x657d5e in doctest::Context::run() /home/firma/devel/json/test/thirdparty/doctest/doctest.h:5938:21 nlohmann#6 0x65c700 in main /home/firma/devel/json/test/thirdparty/doctest/doctest.h:6016:71 nlohmann#7 0x7f17952e32e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) nlohmann#8 0x453f29 in _start (/home/firma/devel/json/build/test/test-msgpack+0x453f29) so to make it happy we use the "official" way of denoting the maximum value of a size_t instead of the shortcut by casting.
- Loading branch information