Skip to content

THRIFT-6052: Limit struct read/write recursion depth in Smalltalk library#3557

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

THRIFT-6052: Limit struct read/write recursion depth in Smalltalk library#3557
Jens-G wants to merge 1 commit into
apache:masterfrom
Jens-G:smalltalk-recursion-depth

Conversation

@Jens-G
Copy link
Copy Markdown
Member

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

Summary

  • Adds recursionDepth instance variable to TProtocol with incrementRecursionDepth / decrementRecursionDepth methods
  • Limit is 64; raises TProtocolError depthLimit on excess
  • Also fixes a pre-existing bug: struct_reader was passing oprot to readStructEnd instead of iprot
  • Smalltalk generator wraps struct read/write blocks with ensure: to guarantee decrement

Test plan

  • Smalltalk unit tests via TProtocolTest in lib/st/

🤖 Generated with Claude Code

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

Client: st

- Add recursionDepth instance variable to TProtocol
- Add incrementRecursionDepth (limit 64) and decrementRecursionDepth
  methods; raises TProtocolError on excess
- Add depthLimit class method to TProtocolError (returns 6)
- Generator wraps struct read/write blocks with ensure: to guarantee
  decrementRecursionDepth always runs even when an exception is raised
- Also fixes a pre-existing bug: struct_reader used oprot instead of
  iprot for readStructEnd

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Jens-G Jens-G requested review from fishy and mhlakhani as code owners May 28, 2026 11:47
@mergeable mergeable Bot added the compiler 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant