Skip to content

Serializing pointer segfaults #1355

Description

@SimonEbner
  • What is the issue you have?
    Serializing a vector/map/.. of pointers segfaults

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?

int main() {
    int i = 1;
    std::vector<int*> values{&i};
    nlohmann::json data = values;
}
  • What is the expected behavior?
    Not sure - I guess compiler error ?

  • And what is the actual behavior instead?
    Segfault - Stack overflow from recursive call to

nlohmann::detail::json_ref<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> >::json_ref<int* const&>
  • Which compiler and operating system are you using? Is it a supported compiler?
    g++ (Ubuntu 8.1.0-5ubuntu1~16.04) 8.1.0

  • Did you use a released version of the library or the version from the develop branch?
    3.3.0

  • If you experience a compilation error: can you compile and run the unit tests?

Not sure what should be the expected behaviour. But I guess segfault is not the desired behaviour.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions