Skip to content

Commit 009a3ad

Browse files
stefanofiorentinohjmjohnson
authored andcommitted
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 <[email protected]>
1 parent 7d16e10 commit 009a3ad

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test_lib_json/main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ JSONTEST_FIXTURE(ValueTest, objects) {
222222
did = object1_.removeMember("some other id", &got);
223223
JSONTEST_ASSERT_EQUAL(Json::Value("bar"), got);
224224
JSONTEST_ASSERT_EQUAL(false, did);
225+
226+
object1_["some other id"] = "foo";
227+
Json::Value* gotPtr = nullptr;
228+
did = object1_.removeMember("some other id", gotPtr);
229+
JSONTEST_ASSERT_EQUAL(nullptr, gotPtr);
230+
JSONTEST_ASSERT_EQUAL(true, did);
225231
}
226232

227233
JSONTEST_FIXTURE(ValueTest, arrays) {

0 commit comments

Comments
 (0)