You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected Behaviour: assigning an existing property on a JSON to a key that does not exist should work the same as when the assignment is made to an existing key, or when any other value is assigned to a key that does not exist.
Actual Behaviour: read access violation
Case 1:
object["existing_key"] = object["old_key"]; //works
Case 2:
object["new_key"] = "new_value"; //works
Case 3:
object["new_key"] = object["old_key"]; //read access violation
Call stack & Error details:
Exception thrown: read access violation. this was 0xFFFFFFFFFFFFFFFF.
boost_json-vc143-mt-gd-x64-1_84.dll!boost::container::pmr::memory_resource::is_equal(const boost::container::pmr::memory_resource & other) Line 59
boost_json-vc143-mt-gd-x64-1_84.dll!boost::container::pmr::operator==(const boost::container::pmr::memory_resource & a, const boost::container::pmr::memory_resource & b) Line 66
boost_json-vc143-mt-gd-x64-1_84.dll!boost::json::value::swap(boost::json::value & other) Line 390
boost_json-vc143-mt-gd-x64-1_84.dll!boost::json::value::operator=(const boost::json::value & other) Line 268
The text was updated successfully, but these errors were encountered:
As I was writing the above, I discovered that you don't get the error if any new element is assigned prior to the copy.
This works:
object["new_key"] = "new_value";
object["another_new_key"] = object["existing_key"];
This does not:
object["another_new_key"] = object["existing_key"]; //read access violation
object["new_key"] = "new_value";
Please provide a minimal complete verifiable example, so that I can attempt to reproduce the error. As is, I tried locally, and the error you are describing doesn't manifest.
Version of Boost
1_84
Steps necessary to reproduce the problem
Expected Behaviour: assigning an existing property on a JSON to a key that does not exist should work the same as when the assignment is made to an existing key, or when any other value is assigned to a key that does not exist.
Actual Behaviour: read access violation
Case 1:
object["existing_key"] = object["old_key"]; //works
Case 2:
object["new_key"] = "new_value"; //works
Case 3:
object["new_key"] = object["old_key"]; //read access violation
Call stack & Error details:
Exception thrown: read access violation.
this was 0xFFFFFFFFFFFFFFFF.
boost_json-vc143-mt-gd-x64-1_84.dll!boost::container::pmr::memory_resource::is_equal(const boost::container::pmr::memory_resource & other) Line 59
boost_json-vc143-mt-gd-x64-1_84.dll!boost::container::pmr::operator==(const boost::container::pmr::memory_resource & a, const boost::container::pmr::memory_resource & b) Line 66
boost_json-vc143-mt-gd-x64-1_84.dll!boost::json::value::swap(boost::json::value & other) Line 390
boost_json-vc143-mt-gd-x64-1_84.dll!boost::json::value::operator=(const boost::json::value & other) Line 268
The text was updated successfully, but these errors were encountered: