Merge pull request #770 from miloyip/issue728_threadsafe

Fixed another crash bug in #728
This commit is contained in:
Milo Yip 2016-10-17 15:35:01 +08:00 committed by GitHub
commit 97fb9bc85b
2 changed files with 11 additions and 0 deletions

View File

@ -1366,6 +1366,9 @@ public:
new (schemaMap_.template Push<SchemaEntry>()) SchemaEntry(refEntry->source, const_cast<SchemaType*>(s), false, allocator_);
}
}
else if (refEntry->schema)
*refEntry->schema = SchemaType::GetTypeless();
refEntry->~SchemaRefEntry();
}

View File

@ -1308,6 +1308,14 @@ TEST(SchemaValidator, Issue608) {
INVALIDATE(s, "{\"a\" : null, \"a\" : null}", "", "required", "");
}
// Fail to resolve $ref in allOf causes crash in SchemaValidator::StartObject()
TEST(SchemaValidator, Issue728_AllOfRef) {
Document sd;
sd.Parse("{\"allOf\": [{\"$ref\": \"#/abc\"}]}");
SchemaDocument s(sd);
VALIDATE(s, "{\"key1\": \"abc\", \"key2\": \"def\"}", true);
}
#ifdef __clang__
RAPIDJSON_DIAG_POP
#endif