Commit e3a8e716 authored by Karl Fogel's avatar Karl Fogel
Browse files

Update pad consumption when doing the new fuzz skipping.

This fixes a bug introduced in commit 52e24e55 that would result in
re-use of pad data.  This also makes some regression tests start
failing, because the used lengths they're expecting are now different;
I will fix the tests in a subsequent commit.

* onetime (Pad._make_fuzz): Adjust pad used length.  I mean, duh.
parent 3249bea2
......@@ -210,6 +210,7 @@ If FORMAT_VERSION is 1, then don't perform the random distance skip
if self._offset is None:
raise Pad.PadUninitialized("pad not yet initialized (no offset)")
fuzz_source = self.padfile.read(fuzz_source_length)
self._length += 4
if len(fuzz_source) < fuzz_source_length:
raise Pad.PadShort("not enough pad available to supply fuzz source")
# What's going on here?
......@@ -281,6 +282,7 @@ If FORMAT_VERSION is 1, then don't perform the random distance skip
fuzz_skip_len = sum([ ord(x) for x in fuzz_source]) % 256
try:
self.padfile.seek(self.padfile.tell() + fuzz_skip_len)
self._length += fuzz_skip_len
except EOFError:
raise Pad.PadShort("not enough pad available to supply fuzz")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment