Andrew Stitcher created PROTON-2967:
---------------------------------------

             Summary: Decode AMQP values iteratively rather than recursively
                 Key: PROTON-2967
                 URL: https://issues.apache.org/jira/browse/PROTON-2967
             Project: Qpid Proton
          Issue Type: Improvement
          Components: proton-c
            Reporter: Andrew Stitcher
            Assignee: Andrew Stitcher
             Fix For: proton-c-0.41.0


Decode AMQP values iteratively: The state a recursive decoder keeps in its 
stack frames - how many children of the enclosing container are still to come, 
and, for an array, the constructor its elements share - can be kept in the 
container's own node, in the scratch space the encoder already uses.

The tree being built is then also the decoder's stack, so the only bound on 
nesting is
the node array: PNI_NID_MAX, and any limit set with pn_data_set_decode_limits().

Every open node - list, map, array and described alike - carries a count of
the children still to be decoded, which lets a single loop close each node as
its last child arrives.

Only accept a single directly nested described type and no more. That is all 
the standard requires (and then only in the case of transaction coordinator 
messages), and it is hard to see a valid use for more deeply nested described 
types.

Restricted descriptors to scalar values only, which is no limitation in 
practice and keeps the descriptor path free of nesting.

 



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to