You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@artemis.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/10/22 15:11:00 UTC

[jira] [Updated] (ARTEMIS-6316) AMQP to Core conversion of an amqp-value body of another type copies the wrong bytes from a pooled buffer

     [ https://issues.apache.org/jira/browse/ARTEMIS-6316?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

ASF GitHub Bot updated ARTEMIS-6316:
------------------------------------
    Labels: pull-request-available  (was: )

> AMQP to Core conversion of an amqp-value body of another type copies the wrong bytes from a pooled buffer
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-6316
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-6316
>             Project: Artemis
>          Issue Type: Bug
>          Components: AMQP
>    Affects Versions: 2.57.0
>            Reporter: Jayakumarindran Thanakodi
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> For an {{amqp-value}} body that is not null, a string, binary, list or map (for example an int), {{AmqpCoreConverter.toCore}} encodes the body section into a pooled heap buffer and copies it into a BytesMessage:
> {code:java} // AmqpCoreConverter.java:197-201 ByteBuf buf = PooledByteBufAllocator.DEFAULT.heapBuffer(1024); ... TLSEncode.getEncoder().writeObject(body); result = createBytesMessage(messageId, buf.array(), 0, buf.writerIndex(), coreMessageObjectPools); {code}
> A pooled heap buffer is a slice of a larger array, so {{buf.array()}} at offset 0 is not where the buffer starts ({{buf.arrayOffset()}}). The Core message gets {{writerIndex}} bytes of whatever else is in that arena.
> Observed (2.57.0, calling the converter directly): a message whose only section is {{amqp-value}} 42 ({{00 53 77 54 2a}}) converts to a BytesMessage whose body is {{00 53 70 c0 08}}, the start of a Header section encoded earlier in the same arena. A Core or JMS consumer of such a message receives those bytes.
> Suggested fix: copy from {{buf.arrayOffset()}} ({{ByteBufUtil.getBytes(buf)}}), or use an unpooled buffer.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@artemis.apache.org
For additional commands, e-mail: issues-help@artemis.apache.org