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

edu.harvard.hul.ois.jhove.ModuleBase: skipBytes() might not skip all requested bytes #71

Closed
RogerMathisen opened this issue May 2, 2016 · 4 comments · Fixed by #194 or #200
Closed
Assignees
Labels
bug A product defect that needs fixing
Milestone

Comments

@RogerMathisen
Copy link
Contributor

RogerMathisen commented May 2, 2016

For large Wavefiles (>100MB) it happens that not all bytes in the DataChunk are skipped as expected in the method:

public long skipBytes(DataInputStream stream, long bytesToSkip, ModuleBase counted)

this seems to be because the call:

long n = stream.skip(bytesToSkip);

Actually might skip fewer bytes than requested (This is also stated in the Java Documentation). If this occurs it will most probably cause the parsing of the Wave file to fail, since the pointer to the next chunk will be placed inside the DATA chunk.

To avoid this problem the "long n = stream.skip(bytesToSkip);" call could be placed inside a loop that continues until all the desired bytes are skipped, or no more bytes kan be skipped (ie n=0).

@carlwilson carlwilson added the bug A product defect that needs fixing label Sep 7, 2016
@carlwilson carlwilson added this to the Release 1.16 milestone Sep 7, 2016
RogerMathisen added a commit to NationalLibraryOfNorway/jhove that referenced this issue Sep 9, 2016
@smmorrissey
Copy link

Sheila +1

@pmay
Copy link

pmay commented Sep 19, 2016

+1

2 similar comments
@asciim0
Copy link
Contributor

asciim0 commented Sep 19, 2016

+1

@friesey
Copy link
Contributor

friesey commented Sep 26, 2016

+1

david-russo added a commit to bl-dpt/jhove that referenced this issue Mar 17, 2017
Broken during incorrect merge of PR openpreserve#117. Each loop of the skip method
was skipping the same amount of bytes, not subtracting the amount already
skipped amount. Reverted to original pull request code then refactored.

Fixes openpreserve#71, fixes openpreserve#193.
david-russo added a commit to bl-dpt/jhove that referenced this issue Mar 17, 2017
Broken during incorrect merge of PR openpreserve#117. Each loop of the skip method
was skipping the same amount of bytes, not subtracting the amount already
skipped. Reverted to original pull request code then refactored.

Fixes openpreserve#71, fixes openpreserve#193.
@carlwilson carlwilson self-assigned this Mar 20, 2017
rgfeldman added a commit to rgfeldman/jhove that referenced this issue Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment