[ 
https://issues.apache.org/jira/browse/THRIFT-6264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18116201#comment-18116201
 ] 

Jens Geyer commented on THRIFT-6264:
------------------------------------

The premise needs a correction. {{incrementRecursionDepth()}} and 
{{decrementRecursionDepth()}} have no call site inside {{lib/dart}}, but the 
Dart generator emits both around every generated struct {{read()}} and 
{{write()}} ({{t_dart_generator.cc}}, THRIFT-6056). So they are in use, and 
removing them would break generated code.

What does hold is the last point of the description. {{TProtocolUtil.skip()}} 
kept a depth count of its own and never used the protocol's, so an unknown 
field inside a nested struct was skipped with a fresh limit. PR #3862 makes 
{{skip()}} count against the protocol as well.

_Drafted with AI assistance (Claude Opus 5); reviewed and posted by Jens Geyer._


> Dart: TProtocol.incrementRecursionDepth and decrementRecursionDepth are never 
> called
> ------------------------------------------------------------------------------------
>
>                 Key: THRIFT-6264
>                 URL: https://issues.apache.org/jira/browse/THRIFT-6264
>             Project: Thrift
>          Issue Type: Bug
>          Components: Dart - Library
>            Reporter: Jens Geyer
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{lib/dart/lib/src/protocol/t_protocol.dart}} defines the pair that is meant 
> to bound how deep a decoder will follow a nested message:
> * {{incrementRecursionDepth()}} -- {{:38}}
> * {{decrementRecursionDepth()}} -- {{:46}}
> Neither has a call site anywhere in {{lib/dart}}. The recursion bound in the 
> binding is applied elsewhere, so the two methods are dead code that reads as 
> though the mechanism were wired up.
> h2. Suggested
> Either call them from the places that descend into a nested value, the way 
> the other bindings do with their equivalents, or remove them so the class 
> does not advertise a mechanism it does not use. Whichever way, the depth 
> handling in the binding should have one implementation, not two.
> _Drafted with AI assistance (Claude Opus 5); reviewed and filed by Jens 
> Geyer._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to