1. 16 Oct, 2019 1 commit
  2. 09 Oct, 2019 1 commit
  3. 07 Oct, 2019 1 commit
    • Thomas Braun's avatar
      test/CMakeLists.txt: Use an explicit list instead of GLOB · eb6fe421
      Thomas Braun authored
      Using GLOB is slow and considered bad practice.
      
      From https://cmake.org/cmake/help/latest/command/file.html:
      
      > We do not recommend using GLOB to collect a list of source files from
      > your source tree. If no CMakeLists.txt file changes when a source is
      > added or removed then the generated build system cannot know when to ask
      > CMake to regenerate. The CONFIGURE_DEPENDS flag may not work reliably on
      > all generators, or if a new generator is added in the future that cannot
      > support it, projects using it will be stuck. Even if CONFIGURE_DEPENDS
      > works reliably, there is still a cost to perform the check on every
      > rebuild.
      eb6fe421
  4. 05 Oct, 2019 1 commit
  5. 03 Oct, 2019 1 commit
  6. 01 Oct, 2019 2 commits
  7. 30 Sep, 2019 2 commits
  8. 26 Sep, 2019 1 commit
  9. 24 Sep, 2019 2 commits
  10. 20 Sep, 2019 2 commits
  11. 19 Sep, 2019 1 commit
  12. 16 Sep, 2019 1 commit
  13. 10 Sep, 2019 3 commits
  14. 03 Sep, 2019 8 commits
    • Thomas Braun's avatar
      8067c3ca
    • Thomas Braun's avatar
    • Thomas Braun's avatar
      Fix outputting extreme integer values in edge cases · 6ce2f35b
      Thomas Braun authored
      For some gcc version (Ubuntu 5.5.0-12ubuntu1~16.04) the existing code
      crashes when the minimum value of int64_t is outputted.
      
      Resurrect the code from before 546e2cbf (🚨 fixed some warnings,
      2019-03-13) but delegate the sign removal so that the compilers don't
      complain about taking the negative value of an unsigned value.
      
      In addition we also rewrite the expression so that we first increment
      and then negate.
      
      The definition of remove_sign(number_unsigned_t) is never called as
      unsigned values are never negative.
      6ce2f35b
    • Thomas Braun's avatar
      .travis.yml: Increase the timeout to 45 minutes · 6d701b29
      Thomas Braun authored
      The clang sanitizer tests, and there especially the unicode tests, can
      hit the default timeout of 25 minutes (1500 seconds) quite easily, so
      let's raise the timeout to 45 minutes (2700 seconds).
      6d701b29
    • Thomas Braun's avatar
      external_constructor<std::valarray>: Handle empty array properly · d5c0d52f
      Thomas Braun authored
      Clang UBSAN complains with the following message when an empty std::valarray is passed in:
      
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/valarray:571:14 in
      
      2/2 Test #68: test-regression_all ..............***Failed    4.68 sec
      /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/valarray:571:14: runtime error: reference binding to null pointer of type 'const do
      uble'
          #0 0x6fbe57 in std::valarray<double>::operator[](unsigned long) const /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/valarray:
      571:7
          #1 0x6fbe57 in double const* std::begin<double>(std::valarray<double> const&) /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/v
      alarray:1207
          #2 0x6fbe57 in void nlohmann::detail::external_constructor<(nlohmann::detail::value_t)2>::construct<nlohmann::basic_json<std::map, std::vector, s
      td::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_seri
      alizer>, double, 0>(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>&, std::valarray<double> const&) /home/firma/devel/json/include/nlohmann/deta
      il/conversions/to_json.hpp:157
          #3 0x5e3fe3 in void nlohmann::detail::to_json<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>, double, 0>(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, nlohman
      n::adl_serializer>&, std::valarray<double> const&) /home/firma/devel/json/include/nlohmann/detail/conversions/to_json.hpp:270:5
          #4 0x5e3fe3 in decltype((to_json(fp, std::forward<std::valarray<double>&>(fp0))) , ((void)())) nlohmann::detail::to_json_fn::operator()<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>, std::valarray<double>&>(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>&, std::valarray<double>&) c
      onst /home/firma/devel/json/include/nlohmann/detail/conversions/to_json.hpp:334
          #5 0x5e3fe3 in decltype((nlohmann::(anonymous namespace)::to_json(fp, std::forward<std::valarray<double>&>(fp0))) , ((void)())) nlohmann::adl_ser
      ializer<std::valarray<double>, void>::to_json<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, st
      d::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>, std::valarray<double>&>(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>&, std::valarray<double>&) /home/firma/devel/json/include/nlohmann/adl_serializer.hpp:45
          #6 0x5e3fe3 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>::basic_json<std::valarray<double>&, std::valarray<double>, 0>(std::valarray<d
      ouble>&) /home/firma/devel/json/include/nlohmann/json.hpp:1257
          #7 0x5e3fe3 in _DOCTEST_ANON_FUNC_2() /home/firma/devel/json/test/src/unit-regression.cpp:1377
          #8 0x77313e in doctest::Context::run() /home/firma/devel/json/test/thirdparty/doctest/doctest.h:5938:21
          #9 0x777ae0 in main /home/firma/devel/json/test/thirdparty/doctest/doctest.h:6016:71
          #10 0x7fae220532e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
          #11 0x4a6479 in _start (/home/firma/devel/json/build/test/test-regression+0x4a6479)
      
      The important thing to note here is that a std::valarray is *not* a STL
      container, so the usual containter and iterator semantics don't apply.
      
      Therefore we have to check if the container is non-empty before.
      d5c0d52f
    • Thomas Braun's avatar
      input_buffer_adapter: Fix handling of nullptr input · 61fe5f1e
      Thomas Braun authored
      Clang UBSAN currently complains that the char * to input_buffer_adapter
      is a nullptr.
      
      Turns out it is actually required to accept nullptr, see for example
      line 415 in input_adapters.hpp
      
        ...
        // the address of first cannot be used: use nullptr
        ia = std::make_shared<input_buffer_adapter>(nullptr, len);
        ....
      
      Therefore we have to handle it gracefully here. We now also ignore the
      length parameter l if b is a nullptr.
      61fe5f1e
    • Thomas Braun's avatar
      .travis/cmake: Rework clang sanitizer invocation · 9ea3e191
      Thomas Braun authored
      - Switch to clang-7
      - Adapt PATH so that llvm-symbolizer can be found for useful stacktraces
      - Adapt compile flags
        "-O0" ensures much faster compile times
        "-fno-sanitize-recover=all
        -fsanitize-recover=unsigned-integer-overflow" this fails the build on
        all issues except unsigned integer overflows. Not failing in this case
        is required in combination with the sanitizer suppression file as only
        recoverable errors can be suppressed.
      
      The UBSAN suppression file ignores errors from stl_bvector.h (which
      holds std::vector<bool>).
      
      Clang reports that error as
      
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:158:20 in
      
            Start 34: test-deserialization_all
      28/88 Test #71: test-testsuites_default .............***Failed    0.32 sec
      /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 be represented in type 'unsigned int'
          #0 0x628f72 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:20
          #1 0x628d16 in std::_Bit_iterator::operator--() /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:251:7
          #2 0x634aac in std::vector<bool, std::allocator<bool> >::pop_back() /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:1010:7
          #3 0x61eff0 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_sax_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::vector, 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:439:28
          #4 0x604864 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::vector, 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
          #5 0x5f8079 in nlohmann::operator>>(std::istream&, 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>&) /home/firma/devel/json/include/nlohmann/json.hpp:6356:42
          #6 0x5e1d92 in _DOCTEST_ANON_FUNC_21() /home/firma/devel/json/test/src/unit-testsuites.cpp:343:9
          #7 0x7207fe in doctest::Context::run() /home/firma/devel/json/test/thirdparty/doctest/doctest.h:5938:21
          #8 0x72681a in main /home/firma/devel/json/test/thirdparty/doctest/doctest.h:6016:71
          #9 0x7f75d22362e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
          #10 0x4c28b9 in _start (/home/firma/devel/json/build/test/test-testsuites+0x4c28b9)
      
      The pop_back() in parser.hpp
      
            assert(not states.empty());
        ->  states.pop_back();
      
      triggers the UBSAN report. But the assertion above ensure that we only
      call pop_back() on an non-empty vector, therefore this is a STL library
      bug and thus must be ignored for us.
      9ea3e191
    • Thomas Braun's avatar
      f0bff49f
  15. 02 Sep, 2019 2 commits
  16. 27 Aug, 2019 3 commits
  17. 26 Aug, 2019 1 commit
  18. 29 Jul, 2019 1 commit
  19. 28 Jul, 2019 6 commits