Skip to content

Encode AMQP 1.0 arrays of zero-octet elements as opaque values (backport #16994)#16998

Merged
michaelklishin merged 1 commit into
v4.3.xfrom
mergify/bp/v4.3.x/pr-16994
Jul 22, 2026
Merged

Encode AMQP 1.0 arrays of zero-octet elements as opaque values (backport #16994)#16998
michaelklishin merged 1 commit into
v4.3.xfrom
mergify/bp/v4.3.x/pr-16994

Conversation

@mergify

@mergify mergify Bot commented Jul 21, 2026

Copy link
Copy Markdown

What?

The AMQP 1.0 binary parser (amqp10_binary_parser) decoded an array whose element constructor has a zero-octet wire encoding (null, true, false, uint0, ulong0, list0 - wire codes 0x40-0x45) by expanding it into a full Erlang list, one term per element, via lists:duplicate/2. It now instead represents such an array as an opaque value ({as_is, TypeCode, Bin}), the same representation already used for decimal and NaN/Infinity values that RabbitMQ has no need to interpret further.

Why

For this class of array, the element count is carried in a small, fixed-size wire encoding, while the previous implementation allocated one term per element when decoding it. This meant the memory needed to hold the decoded value had no relationship to the size of the input that produced it. Representing the value opaquely removes that mismatch entirely, rather than merely capping it, and keeps the parser consistent with how it already treats other value kinds it does not need to interpret.

Supersedes #16986


This is an automatic backport of pull request #16994 done by Mergify.

 ## What?

The AMQP 1.0 binary parser (amqp10_binary_parser) decoded an array
whose element constructor has a zero-octet wire encoding (null, true,
false, uint0, ulong0, list0 - wire codes 0x40-0x45) by expanding it
into a full Erlang list, one term per element, via lists:duplicate/2.
It now instead represents such an array as an opaque value ({as_is,
TypeCode, Bin}), the same representation already used for decimal and
NaN/Infinity values that RabbitMQ has no need to interpret further.

 ## Why

For this class of array, the element count is carried in a small,
fixed-size wire encoding, while the previous implementation allocated
one term per element when decoding it. This meant the memory needed to
hold the decoded value had no relationship to the size of the input
that produced it. Representing the value opaquely removes that
mismatch entirely, rather than merely capping it, and keeps the parser
consistent with how it already treats other value kinds it does not
need to interpret.

(cherry picked from commit 3f0f67d)
@mergify mergify Bot assigned ansd Jul 21, 2026
@mergify

mergify Bot commented Jul 21, 2026

Copy link
Copy Markdown
Author

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@michaelklishin michaelklishin added this to the 4.3.4 milestone Jul 21, 2026
@michaelklishin
michaelklishin merged commit 5bc4715 into v4.3.x Jul 22, 2026
360 of 361 checks passed
@michaelklishin
michaelklishin deleted the mergify/bp/v4.3.x/pr-16994 branch July 22, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants