Skip to content

Commit

Permalink
Skip over List and Map encountered by ReadAny
Browse files Browse the repository at this point in the history
  • Loading branch information
ngbrown committed Apr 11, 2024
1 parent 0feaf11 commit 199a19e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions RabbitMQ.Stream.Client/AMQP/AmqpWireFormattingRead.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,35 @@ internal static int ReadAny(ref SequenceReader<byte> reader, out object value)
value = null;
reader.Advance(1);
return 1;

case FormatCode.List0:
case FormatCode.List8:
case FormatCode.List32:
{
offset = ReadListHeader(ref reader, out var fields);
for (long i = 0; i < fields; i++)
{
offset += ReadAny(ref reader, out _);
}

value = null;
return offset;
}

case FormatCode.Map8:
case FormatCode.Map32:
{
offset = ReadMapHeader(ref reader, out var count);
var values = count / 2;
for (uint i = 0; i < values; i++)
{
offset += ReadAny(ref reader, out _);
offset += ReadAny(ref reader, out _);
}

value = null;
return offset;
}
}

throw new AmqpParseException($"Read Any: Invalid type: {type}");
Expand Down

0 comments on commit 199a19e

Please sign in to comment.