Skip to content

THRIFT-6055: Limit struct read/write recursion depth in JavaME library#3560

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

THRIFT-6055: Limit struct read/write recursion depth in JavaME library#3560
Jens-G wants to merge 1 commit into
apache:masterfrom
Jens-G:javame-recursion-depth

Conversation

@Jens-G
Copy link
Copy Markdown
Member

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

Summary

  • Adds DEPTH_LIMIT = 6 constant to TProtocolException
  • Adds incrementRecursionDepth() / decrementRecursionDepth() to TProtocol with a hard limit of 64
  • JavaME generator wraps generated struct read and write bodies with try/finally to guarantee the counter is always restored

Test plan

  • JavaME build and unit tests pass

🤖 Generated with Claude Code

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

Client: javame

Add DEPTH_LIMIT constant (6) to TProtocolException, plus
incrementRecursionDepth()/decrementRecursionDepth() methods to
TProtocol with a fixed limit of 64.  Update the JavaME generator to
call these around struct read and write bodies using try/finally so the
counter is always restored even when an exception propagates.

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 java Pull requests that update Java code compiler labels 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

compiler java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant