Skip to content

json object's creation can freezes execution #231

@cfoursan

Description

@cfoursan

When I try create json object and if no memory to allocate there is execution freeze instead of std::bad_alloc.

Gdb trace:
Thread 541 (Thread 0x7fc74f64a700 (LWP 133066)):
#0 0x000000000043cf71 in ZSt3getILm0EIPSt6vectorIN8nlohmann10basic_jsonISt3mapS0_SsblmdSaEESaIS4_EEZNS4_6createIS6_ISt16initializer_listIS4_EEEEPT_DpOT0_EUlS7_E_EENSt11__add_c_refINSt13tuple_elementIXT_ESt5tupleIIDpT0_EEE4typeEE4typeERKSM (__t=empty std::tuple) at /usr/include/c++/4.8/tuple:766
#1 0x000000000043cf9c in _ZNKSt10unique_ptrISt6vectorIN8nlohmann10basic_jsonISt3mapS0_SsblmdSaEESaIS4_EEZNS4_6createIS6_ISt16initializer_listIS4_EEEEPT_DpOT0_EUlPS6_E_E3getEv (this=0x7fc74f648ba0) at /usr/include/c++/4.8/bits/unique_ptr.h:234
#2 0x000000000043a1d1 in nlohmann::basic_json<std::map, std::vector, std::string, bool, long, unsigned long, double, std::allocator>::create<std::vector<nlohmann::basic_json<std::map, std::vector, std::string, bool, long, unsigned long, double, std::allocator>, std::allocator<nlohmann::basic_json<std::map, std::vector, std::string, bool, long, unsigned long, double, std::allocator> > >, std::initializer_list<nlohmann::basic_json<std::map, std::vector, std::string, bool, long, unsigned long, double, std::allocator> > >(std::initializer_list<nlohmann::basic_json<std::map, std::vector, std::string, bool, long, unsigned long, double, std::allocator> >&&) () at ../src/json.hpp:689
#3 0x0000000000437af4 in nlohmann::basic_json<std::map, std::vector, std::string, bool, long, unsigned long, double, std::allocator>::basic_json (this=0x7fc74f648f30, init=..., type_deduction=true, manual_type=nlohmann::basic_json<std::map, std::vector, std::basic_string<char, std::char_traits, std::allocator >, bool, long, unsigned long, double, std::allocator>::array) at ../src/json.hpp:1571

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions