Merge pull request #199 from tyler92/stack-overflow-invalid-ref

Fix stack overflow for unresolved references
This commit is contained in:
Tristan Penman 2024-10-21 20:42:00 +11:00 committed by GitHub
commit ad1e184b1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1040,13 +1040,14 @@ private:
resolveThenPopulateSchema(rootSchema, newRootNode, referencedAdapter, subschema, {}, actualJsonPointer,
fetchDoc, parentSchema, ownName, docCache, schemaCache);
} else {
} else if (!actualJsonPointer.empty()) {
const AdapterType &referencedAdapter =
internal::json_pointer::resolveJsonPointer(rootNode, actualJsonPointer);
// TODO: Need to detect degenerate circular references
resolveThenPopulateSchema(rootSchema, rootNode, referencedAdapter, subschema, {}, actualJsonPointer,
fetchDoc, parentSchema, ownName, docCache, schemaCache);
} else {
throwRuntimeError("Cannot resolve reference \"" + jsonRef + "\".");
}
}