Giter Site home page Giter Site logo

ordered json pointer corruption about json HOT 5 OPEN

mishase avatar mishase commented on September 22, 2024
ordered json pointer corruption

from json.

Comments (5)

nlohmann avatar nlohmann commented on September 22, 2024

This seems related to #4279.

from json.

gregmarr avatar gregmarr commented on September 22, 2024

As in the linked issue, you can't do that. The push_back function on vector can invalidate pointers, and ordered_json uses a vector.

from json.

mishase avatar mishase commented on September 22, 2024

It is related to the issue you mentioned earlier, but it's certainly NOT a documentation issue. ordered_json must have working push_back function without any pointer corruption or this function must be private if it can cause such behaviour. Please fix this

from json.

nlohmann avatar nlohmann commented on September 22, 2024

I have no idea how to fix it, so documentation is currently all we can do.

from json.

gregmarr avatar gregmarr commented on September 22, 2024

@mishase This behavior comes from std::vector<>::push_back(), so not only is it not broken, it is standards conforming.

https://en.cppreference.com/w/cpp/container/vector/push_back

If after the operation the new size() is greater than old capacity() a reallocation takes place, in which case all iterators (including the end() iterator) and all references to the elements are invalidated. Otherwise only the end() iterator is invalidated.

from json.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.