Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrong data from Blob/Clob when mark/reset is used #971

Merged
merged 6 commits into from Mar 11, 2018

Conversation

Projects
None yet
3 participants
@sfeigl
Copy link
Contributor

sfeigl commented Sep 30, 2017

Hi,

I spotted an incorrect behaviour using LargeObject BlobInputStream mark() and reset() methods.

Both methods do not take the internal buffer in account.

  • mark() actually marks the position after the last byte in the buffer
  • reset() changes the large object position, but does not clear the buffer. Buffered bytes from the old position are still returned after reset() until the buffer is depleted.

Here is a suggested fix. The reset() method could be more sophisticated by checking wheter parts of the buffer could be reused.

@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Sep 30, 2017

Codecov Report

Merging #971 into master will increase coverage by 0.03%.
The diff coverage is 71.42%.

@@             Coverage Diff              @@
##             master     #971      +/-   ##
============================================
+ Coverage     67.38%   67.42%   +0.03%     
- Complexity     3687     3689       +2     
============================================
  Files           170      170              
  Lines         15638    15640       +2     
  Branches       2531     2532       +1     
============================================
+ Hits          10538    10545       +7     
+ Misses         3917     3911       -6     
- Partials       1183     1184       +1

@vlsi vlsi force-pushed the pgjdbc:master branch from 4a6d1d1 to 5819f31 Jan 17, 2018

@vlsi vlsi added this to the 42.2.2 milestone Mar 10, 2018

Selene Feigl and others added some commits Sep 30, 2017

@vlsi vlsi changed the title Bug blob mark fix: wrong data from Blob/Clob when mark/reset is used Mar 10, 2018

@vlsi vlsi force-pushed the sfeigl:bug_blob_mark branch from 3a55774 to cba0986 Mar 10, 2018

@vlsi vlsi force-pushed the sfeigl:bug_blob_mark branch from cba0986 to b95f48b Mar 10, 2018

@vlsi vlsi merged commit 61e1c30 into pgjdbc:master Mar 11, 2018

2 checks passed

codecov/project 67.42% (+0.03%) compared to 44bb7f8
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

rhavermans added a commit to bolcom/pgjdbc that referenced this pull request Jul 13, 2018

fix: wrong data from Blob/Clob when mark/reset is used (pgjdbc#971)
BlobInputStream#reset() did not invalidate read buffer, thus it resulted in reading wrong data.

rhavermans added a commit to bolcom/pgjdbc that referenced this pull request Jul 13, 2018

fix: wrong data from Blob/Clob when mark/reset is used (pgjdbc#971)
BlobInputStream#reset() did not invalidate read buffer, thus it resulted in reading wrong data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.