From 57d9f6beb61fdd01c765a26a7e8aaf4e2caa6919 Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Thu, 16 Oct 2008 12:48:48 -0700
Subject: [PATCH] repairer: fix flaw in testutil.flip_one_bit() that Brian
 pointed out

---
 src/allmydata/util/testutil.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/allmydata/util/testutil.py b/src/allmydata/util/testutil.py
index 27e4f069..84911306 100644
--- a/src/allmydata/util/testutil.py
+++ b/src/allmydata/util/testutil.py
@@ -19,7 +19,7 @@ def flip_one_bit(s, offset=0, size=None):
     """ flip one random bit of the string s, in a byte greater than or equal to offset and less
     than offset+size. """
     if size is None:
-        size=len(s)
+        size=len(s)-offset
     i = randrange(offset, offset+size)
     result = s[:i] + chr(ord(s[i])^(0x01<<randrange(0, 8))) + s[i+1:]
     assert result != s, "Internal error -- flip_one_bit() produced the same string as its input: %s == %s" % (result, s)
-- 
2.45.2