Skip to content

Conversation

@michaelklishin
Copy link
Collaborator

This is #12888 re-submitted by me so that the PR has access to relevant GH secrets.

I've also added one more test case with a different character range.

bpint and others added 2 commits December 4, 2024 10:39
`rabbit_binary_generator:map_exception/3` will crash when there are
unicode characters in the `explaination` field of `Reason#amqp_error`
parameter. The explaination string (list) is assumed to be ascii, with
each character/member in the range of a byte. Any unicode characters
in the string will trigger `badarg` crash of `list_to_binary/1` in
`rabbit_binary_generator:amqp_exception_explanation/2`.

Amqp091 shovel crash due to this is reported,
#12874
When a queue as shovel source/destination does not exist, and its
name contains non-ascii characters, the explaination of amqp_error
will be like `no queue non_ascii_name_😍 in vhost /`. It will
subsequently crash and even affect management console.

To fix this, `unicode:characters_to_binary/1` is used instead of
`list_to_binary/1`, and unicode-safe truncation of long explaination
with `io_lib:format/3` chars_limit replaces direct bytes truncation.
@michaelklishin michaelklishin merged commit 28b0b05 into main Dec 4, 2024
271 checks passed
@michaelklishin michaelklishin deleted the rabbitmq-server-12888 branch December 4, 2024 04:35
@michaelklishin michaelklishin added this to the 4.1.0 milestone Dec 4, 2024
michaelklishin added a commit that referenced this pull request Dec 4, 2024
By @bpint: Fixes an exception in AMQP 0-9-1 exception (error) generator when input data includes non-ASCII characters (backport #12889)
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.

3 participants