]> arthur.barton.de Git - bup.git/commitdiff
tests: vint: test EOFError after first byte
authorJohannes Berg <johannes@sipsolutions.net>
Wed, 29 Jan 2020 19:09:49 +0000 (20:09 +0100)
committerRob Browning <rlb@defaultvalue.org>
Sun, 2 Feb 2020 18:14:49 +0000 (12:14 -0600)
Since the first byte is handled separately for the sign bit,
validate that we also get an EOFError if there are a few
bytes but the last one also has the 0x80 bit set.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/t/tvint.py

index 0cb8d732b90446c355c907655b49ca673b1c3b4e..6bee0f32662946435c036ca1500cecf7b17cc2d2 100644 (file)
@@ -38,6 +38,7 @@ def test_vint():
         for x in [-x for x in values]:
             WVPASSEQ(encode_and_decode_vint(x), x)
         WVEXCEPT(EOFError, vint.read_vint, BytesIO())
+        WVEXCEPT(EOFError, vint.read_vint, BytesIO(b"\x80\x80"))
 
 
 def encode_and_decode_bvec(x):