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

Kristian Waagan updated DERBY-3735:
-----------------------------------

    Attachment: derby-3735-1a.stat
                derby-3735-1a.diff

Attaching 'derby-3735-1a.diff' that does the following:

 * PositionedStoreStream
    Fixed the position calculation.
    Implemented read(byte[]) by forwarding to read(byte[],int,int).

 * LoopingAlphabetStream
   Made it implement Resetable, so it can be used for testing 
PositionedStoreStream.

 * PositionedStoreStreamTest
   Some simple tests and a regression test for the bug.
   Takes less than half a second to run (no database access).

 * _Suite
    Added the new test to the store suite.


I ran the regression tests without failures.
Patch ready for review.

> Incorrect position calculation in PositionedStoreStream with read(byte[],...)
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-3735
>                 URL: https://issues.apache.org/jira/browse/DERBY-3735
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Store
>    Affects Versions: 10.3.1.4, 10.4.1.3, 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-3735-1a.diff, derby-3735-1a.stat
>
>
> A bug in the methods 'read(byte[])' and 'read(byte[],int,int)' in 
> PositionedStoreStream can cause the position variable to be set to an 
> incorrect value.
> The bug is only triggered if one of the two read methods is invoked after EOF 
> of the underlying stream has been reached.
> If the bug is triggered, the position will be decreased by one because the 
> underlying stream returns -1. Subsequent reads will further decrease the 
> position. This can cause EOF-exceptions (during repositioning) or incorrect 
> data being returned in subsequent calls.

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

Reply via email to