[ 
https://issues.apache.org/jira/browse/QPID-6786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15636948#comment-15636948
 ] 

ASF subversion and git services commented on QPID-6786:
-------------------------------------------------------

Commit 1768064 from [~k-wall] in branch 'java/trunk'
[ https://svn.apache.org/r1768064 ]

QPID-6786: [Java Common] Prevent AbstractEncoder generating str8 or str16 that 
exceed the type's limits

Also use StandardCharsets.UTF_8 to avoid the exception handling clutter.

> (0-10) ServerAssembler fails with IndexOutOfBoundsException on receipt of 
> message with large headers
> ----------------------------------------------------------------------------------------------------
>
>                 Key: QPID-6786
>                 URL: https://issues.apache.org/jira/browse/QPID-6786
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: qpid-java-6.0
>            Reporter: Keith Wall
>            Assignee: Lorenz Quack
>            Priority: Blocker
>             Fix For: qpid-java-6.0
>
>
> In a regression since 0.32, if I run the following program, the Java Broker 
> fails with the following IOOBE.
> {noformat}
> ava.lang.IndexOutOfBoundsException: Index: 1, Size: 1
>       at java.util.Collections$SingletonList.get(Collections.java:3375)
>       at 
> org.apache.qpid.server.protocol.v0_10.ServerDecoder.getCurrentBuffer(ServerDecoder.java:111)
>       at 
> org.apache.qpid.server.protocol.v0_10.ServerDecoder.advanceIfNecessary(ServerDecoder.java:41)
>       at 
> org.apache.qpid.server.protocol.v0_10.ServerDecoder.getBuffer(ServerDecoder.java:49)
>       at 
> org.apache.qpid.server.protocol.v0_10.ServerDecoder.readUint16(ServerDecoder.java:142)
>       at 
> org.apache.qpid.server.protocol.v0_10.ServerAssembler.assemble(ServerAssembler.java:201)
>       at 
> org.apache.qpid.server.protocol.v0_10.ServerAssembler.frame(ServerAssembler.java:152)
>       at 
> org.apache.qpid.server.protocol.v0_10.ServerAssembler.received(ServerAssembler.java:80)
>       at 
> org.apache.qpid.server.protocol.v0_10.ServerInputHandler.parse(ServerInputHandler.java:175)
>       at 
> org.apache.qpid.server.protocol.v0_10.ServerInputHandler.received(ServerInputHandler.java:82)
>       at 
> org.apache.qpid.server.protocol.v0_10.AMQPConnection_0_10$3.run(AMQPConnection_0_10.java:199)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at 
> org.apache.qpid.server.protocol.v0_10.AMQPConnection_0_10.received(AMQPConnection_0_10.java:191)
>       at 
> org.apache.qpid.server.transport.MultiVersionProtocolEngine.received(MultiVersionProtocolEngine.java:141)
>       at 
> org.apache.qpid.server.transport.NonBlockingConnection.processAmqpData(NonBlockingConnection.java:446)
>       at 
> org.apache.qpid.server.transport.NonBlockingConnectionPlainDelegate.processData(NonBlockingConnectionPlainDelegate.java:58)
>       at 
> org.apache.qpid.server.transport.NonBlockingConnection.doRead(NonBlockingConnection.java:349)
>       at 
> org.apache.qpid.server.transport.NonBlockingConnection.doWork(NonBlockingConnection.java:223)
>       at 
> org.apache.qpid.server.transport.NetworkConnectionScheduler.processConnection(NetworkConnectionScheduler.java:143)
>       at 
> org.apache.qpid.server.transport.NetworkConnectionScheduler.access$000(NetworkConnectionScheduler.java:37)
>       at 
> org.apache.qpid.server.transport.NetworkConnectionScheduler$2.run(NetworkConnectionScheduler.java:112)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>       at java.lang.Thread.run(Thread.java:745)
> {noformat}
> {noformat:java}
>             ConnectionFactory connectionFactory = (ConnectionFactory) 
> context.lookup("qpidConnectionfactory");
>             Connection connection = connectionFactory.createConnection();
>             connection.start();
>             Session session = connection.createSession(false, 
> Session.AUTO_ACKNOWLEDGE);
>             Destination destination = (Destination) 
> context.lookup("topicExchange");
>             MessageProducer messageProducer = 
> session.createProducer(destination);
>             MessageConsumer messageConsumer = 
> session.createConsumer(destination);
>             TextMessage message = session.createTextMessage("Hello world!");
>             message.setStringProperty("str1", new String(new byte[32000]));
>             message.setStringProperty("str2", new String(new byte[32000]));
>             message.setStringProperty("str3", new String(new byte[32000]));
>             messageProducer.send(message);
>             message = (TextMessage)messageConsumer.receive();
>             System.out.println(message.getText());
>             System.out.println(message.getStringProperty("str1").length());
>             System.out.println(message.getStringProperty("str2").length());
>             System.out.println(message.getStringProperty("str3").length());
>             System.out.println(message.getText());
>             connection.close();
>             context.close();
> {noformat}
> Same program passed successfully against 0.32.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to