avoid reference to null pointer and member access within null pointer
UBSAN gave issues with the typeless Schema: runtime error: reference binding to null pointer of type 'rapidjson::GenericSchemaDocument<rapidjson::GenericValue<rapidjson::UTF16<wchar_t>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >, rapidjson::CrtAllocator>' and runtime error: member access within null pointer of type 'AllocatorType' (aka 'rapidjson::CrtAllocator')
This commit is contained in:
parent
fe550f3866
commit
8074b722f0
@ -413,9 +413,11 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AssignIfExist(allOf_, *schemaDocument, p, value, GetAllOfString(), document);
|
if (schemaDocument) {
|
||||||
AssignIfExist(anyOf_, *schemaDocument, p, value, GetAnyOfString(), document);
|
AssignIfExist(allOf_, *schemaDocument, p, value, GetAllOfString(), document);
|
||||||
AssignIfExist(oneOf_, *schemaDocument, p, value, GetOneOfString(), document);
|
AssignIfExist(anyOf_, *schemaDocument, p, value, GetAnyOfString(), document);
|
||||||
|
AssignIfExist(oneOf_, *schemaDocument, p, value, GetOneOfString(), document);
|
||||||
|
}
|
||||||
|
|
||||||
if (const ValueType* v = GetMember(value, GetNotString())) {
|
if (const ValueType* v = GetMember(value, GetNotString())) {
|
||||||
schemaDocument->CreateSchema(¬_, p.Append(GetNotString(), allocator_), *v, document);
|
schemaDocument->CreateSchema(¬_, p.Append(GetNotString(), allocator_), *v, document);
|
||||||
@ -578,7 +580,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
~Schema() {
|
~Schema() {
|
||||||
allocator_->Free(enum_);
|
if (allocator_) {
|
||||||
|
allocator_->Free(enum_);
|
||||||
|
}
|
||||||
if (properties_) {
|
if (properties_) {
|
||||||
for (SizeType i = 0; i < propertyCount_; i++)
|
for (SizeType i = 0; i < propertyCount_; i++)
|
||||||
properties_[i].~Property();
|
properties_[i].~Property();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user