db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4088) DDMReader readBytes ArrayIndexOutOfBoundsException
Date Mon, 16 Mar 2009 12:40:50 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12682303#action_12682303

Knut Anders Hatlen commented on DERBY-4088:

Two of the test cases (testBigTable and testLargeReplies) in derbynet/PrepareStatementTest
trigger the method in Reply.java. Looking more closely at the code in Reply.java, I don't
think the problem is present on the client. When it calls compressBLayerData(), it does this:

            ensureALayerDataInBuffer(desiredDataSize + (continueDssHeaderCount * 2));

Note that we add (continueDssHeaderCount*2) before calling ensureALayerDataInBuffer(). (continueDssHeaderCount*2)
is equal to the overhead imposed by splitting the data, so it ensures that we have all the
data we need before we enter compressBLayerData().

For consistency, it might be a good idea to do the same both places. I think that the solution
in Reply.java is simpler than the solution I chose in DDMReader.java, so I think I'll back
out those changes and use the other approach in DDMReader too.

> DDMReader readBytes ArrayIndexOutOfBoundsException
> --------------------------------------------------
>                 Key: DERBY-4088
>                 URL: https://issues.apache.org/jira/browse/DERBY-4088
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions:
>         Environment: CentOS 5, java 1.6.0_11
>            Reporter: Urban Widmark
>            Assignee: Knut Anders Hatlen
>             Fix For:
>         Attachments: derby-4088.diff, derby-ddm.patch, DerbyBug.java
> DDMReader.readBytes(int length) checks the length vs DssConstants.MAX_DSS_LENGTH, but
ignores the fact that the buffer position "pos" might not be 0. If pos is non-zero then the
pos + length can be larger than the size of "buffer" causing an ArrayIndexOutOfBoundsException.
> For me this happened when sending a BLOB that was 32766 bytes long. The value of pos
was 2 in that method.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message