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

Repair sometimes tries to read beyond EOF #29

Closed
jcfp opened this issue Apr 30, 2014 · 1 comment
Closed

Repair sometimes tries to read beyond EOF #29

jcfp opened this issue Apr 30, 2014 · 1 comment

Comments

@jcfp
Copy link
Contributor

jcfp commented Apr 30, 2014

As the title says. I stumbled upon this by coincidence, when I intentionally damaged a file (as part of a test) by truncating it and subsequently trying to have par2 repair it. Happens with 0.6.6 as well as with older versions, 0.4 included, with multiple files and on multiple systems.

Probably also the cause of this old bug report in debian:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=415984

To reproduce (starting from an empty dir...):
"""
wget -O test.data https://github.com/BlackIkeEagle/par2cmdline/archive/rel-0-1.zip
par2 c -r10 test.par2 test.data
mv test.data test.data-correct
head -c 113579 test.data-correct > test.data
par2 r test.par2
"""

The repair process will error out:
"Could not read 60 bytes from ./test.data.1 at offset 113520"

Note that (in this example) truncating one byte more or one byte less results in a correct repair. Badness also happens when truncating the test.data to 115259, 116519, 116339 at least.

The following script tries to find the troublesome truncations by brute forcing:
(note: not very fast...; the default settings should be good for use with the test.data supplied above)
See https://gist.github.com/jcfp/f9de277f3610fa842f0f

@BlackIkeEagle
Copy link
Member

from what i see par2 was not made to cope with broken files who have a different filesize than the original.

i think i can fix it anyway but have to make sure nothing else breaks

BlackIkeEagle added a commit that referenced this issue May 10, 2014
Signed-off-by: BlackEagle <ike.devolder@gmail.com>
pcordes pushed a commit to pcordes/par2-cleanhistory that referenced this issue May 6, 2015
Resolves Parchive#29

Signed-off-by: BlackEagle <ike.devolder@gmail.com>
pcordes pushed a commit to pcordes/par2-cleanhistory that referenced this issue May 6, 2015
Signed-off-by: BlackEagle <ike.devolder@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants