Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std::bad_alloc() when header table is empty #326

Open
olii opened this issue Aug 3, 2023 · 0 comments
Open

std::bad_alloc() when header table is empty #326

olii opened this issue Aug 3, 2023 · 0 comments

Comments

@olii
Copy link

olii commented Aug 3, 2023

There is a bug when the AMQP header table has a nested table that is empty (0 entries). The exception std::bad_alloc() is thrown.

This is the line:

case AMQP_FIELD_KIND_TABLE:
new_value.value.table = CopyTableInner(value.value.table, pool);

Then this is called and it throws the exception:
amqp_table_t TableValueImpl::CopyTableInner(const amqp_table_t &table,
amqp_pool_t &pool) {
amqp_table_t new_table;
new_table.num_entries = table.num_entries;
new_table.entries = (amqp_table_entry_t *)amqp_pool_alloc(
&pool, sizeof(amqp_table_entry_t) * table.num_entries);
if (NULL == new_table.entries) {
throw std::bad_alloc();

I experience this by trying to consume the celery v5.3.1 event.
image
The stamps is a table that has no entries.

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

No branches or pull requests

1 participant