mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-27 11:21:02 +08:00
issue_836: Check if `removed' is a valid pointer before copy data to it
functions involved: - bool Value::removeMember(const char* key, const char* cend, Value* removed) Signed-off-by: Stefano Fiorentino <stefano.fiore84@gmail.com>
This commit is contained in:
parent
7d16e10113
commit
009a3ad24c
@ -222,6 +222,12 @@ JSONTEST_FIXTURE(ValueTest, objects) {
|
||||
did = object1_.removeMember("some other id", &got);
|
||||
JSONTEST_ASSERT_EQUAL(Json::Value("bar"), got);
|
||||
JSONTEST_ASSERT_EQUAL(false, did);
|
||||
|
||||
object1_["some other id"] = "foo";
|
||||
Json::Value* gotPtr = nullptr;
|
||||
did = object1_.removeMember("some other id", gotPtr);
|
||||
JSONTEST_ASSERT_EQUAL(nullptr, gotPtr);
|
||||
JSONTEST_ASSERT_EQUAL(true, did);
|
||||
}
|
||||
|
||||
JSONTEST_FIXTURE(ValueTest, arrays) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user