Archived
grammar.cpp guarded the json-schema-to-grammar converter with a depth check -- kMaxSchemaDepth, added because a deeply nested schema crashes the converter -- but it built the tree to measure with Json::parse, the unbounded read. A schema nested past the guard's own reach was already a stack overflow by the time json_depth ran: the check sat after the thing it was written against. The schema is now read with parse_bounded at exactly the depth the check promises, plus a 2^20 value cap, so the refusal fires during the read, before any nested tree exists to be walked, dumped or destroyed. Every current caller already hands over a bounded body, but this entry point does not know that -- it takes a string.