You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Jiri Daněk (JIRA)" <ji...@apache.org> on 2018/01/24 16:41:00 UTC

[jira] [Commented] (ARTEMIS-1412) Coverity: Use of freed resources in LargeMessageControllerImpl.java

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

Jiri Daněk commented on ARTEMIS-1412:
-------------------------------------

My current belief is that this is not a problem. Even if it is indeed possible to call {sendPacketToOutput()} with a closed {output}, {IOException} will be thrown and all will be well.

> Coverity: Use of freed resources in LargeMessageControllerImpl.java
> -------------------------------------------------------------------
>
>                 Key: ARTEMIS-1412
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1412
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 2.4.0
>            Reporter: Jiri Daněk
>            Priority: Minor
>
> {noformat}
> 245      synchronized (this) {
>    	1. Condition currentPacket != null, taking true branch.
> 246         if (currentPacket != null) {
>    	2. object_freed: sendPacketToOutput frees output. [show details]
> 247            sendPacketToOutput(output, currentPacket);
> 248            currentPacket = null;
> 249         }
>    	3. Condition handledException == null, taking true branch.
> 250         while (handledException == null) {
> 251            LargeData packet = largeMessageData.poll();
>    	4. Condition packet == null, taking false branch.
> 252            if (packet == null) {
> 253               break;
> 254            }
> 255            totalFlowControl += packet.getFlowControlSize();
> 256
> 257            continues = packet.isContinues();
>    	
> CID 1409518: Use of freed resources (USE_AFTER_FREE)
> 5. use_after_free: sendPacketToOutput uses freed object output. [show details]
> 258            sendPacketToOutput(output, packet);
> 259         }
> 260
> 261         checkException();
> 262         outStream = output;
> 263      }
> 264
> {noformat}
> {noformat}
> 69   private void sendPacketToOutput(final OutputStream output, final LargeData packet) throws ActiveMQException {
> 1070      try {
> 1071         output.write(packet.getChunk());
>     	1. Condition !packet.isContinues(), taking true branch.
> 1072         if (!packet.isContinues()) {
> 1073            streamEnded = true;
>     	2. object_freed: close frees parameter output.
> 1074            output.close();
> 1075         }
> 1076      } catch (IOException e) {
> 1077         throw ActiveMQClientMessageBundle.BUNDLE.errorWritingLargeMessage(e);
> 1078      }
> 1079   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)