SIGN IN SIGN UP

harden(content): cap DocC render recursion depth (DoS guard)

Thread a depth counter through the block/inline render recursion in render-content.js and
render-html/nodes.js, returning empty past MAX_RENDER_DEPTH (512) instead of overflowing the
call stack on hostile or malformed deeply-nested DocC. The cap mirrors the Swift renderer's
ADJSON.parse(maxDepth: 512) bound, so JS<->Swift output stays byte-identical on real data
(<= ~10 levels deep). Adds a regression test: a 50k-deep tree renders without overflow.

(cherry picked from commit e94d5544d71dc5fc2495eeaa85b9547845148196)
G
Gigi committed
bb710291b5495e75443c448c78b1df8c93c4f81d
Parent: 8bd6160