Skip to content

THRIFT-6053: Limit struct read/write recursion depth in D library#3558

Draft
Jens-G wants to merge 1 commit into
apache:masterfrom
Jens-G:d-recursion-depth
Draft

THRIFT-6053: Limit struct read/write recursion depth in D library#3558
Jens-G wants to merge 1 commit into
apache:masterfrom
Jens-G:d-recursion-depth

Conversation

@Jens-G
Copy link
Copy Markdown
Member

@Jens-G Jens-G commented May 28, 2026

Summary

  • Adds a thread-local recursion depth counter in thrift.codegen.base
  • readStruct and writeStruct increment on entry and decrement via scope(exit) on normal or exceptional return
  • Limit is 64; raises TProtocolException.DEPTH_LIMIT on excess
  • Includes unittest verifying depth limit and rollback behaviour

Test plan

  • unittest block in lib/d/ verifies depth limit and counter restoration

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Client: d

- Add a thread-local recursion depth counter in thrift.codegen.base
- readStruct and writeStruct increment the counter on entry and
  decrement it via scope(exit) on normal or exceptional exit
- Limit is 64 levels; raises TProtocolException.DEPTH_LIMIT on excess
- Add unittest verifying the depth limit and rollback behaviour

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mergeable mergeable Bot added the d Pull requests that update D code label May 28, 2026
@Jens-G Jens-G marked this pull request as draft May 28, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

d Pull requests that update D code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant