, RecoverCorruptHeaderGZMultiTest \
, RecoverCorruptHeaderGZAESSingleTest \
, RecoverCorruptHeaderGZAESMultiTest \
+ , RecoverCorruptHeaderCTSizeGZAESTest \
, RecoverCorruptEntireHeaderSingleTest \
, RecoverCorruptEntireHeaderMultiTest \
, RecoverCorruptEntireHeaderGZSingleTest \
, RecoverCorruptHeaderGZMultiTest
, RecoverCorruptHeaderGZAESSingleTest
, RecoverCorruptHeaderGZAESMultiTest
+ , RecoverCorruptHeaderCTSizeGZAESTest
, RecoverCorruptEntireHeaderSingleTest
, RecoverCorruptEntireHeaderMultiTest
, RecoverCorruptEntireHeaderGZSingleTest
## corruption simulators ##
###############################################################################
+class UndefinedTest (Exception):
+ """No test available for the asked combination of parameters."""
+
def corrupt_header (_, fname, compress, encrypt):
"""
Modify a significant byte in the object header of the format.
flip_bits (fname, 100 + 8 + 8 + 8 + 12 + 12 + 1)
+def corrupt_ctsize (_, fname, compress, encrypt):
+ """
+ Blow up the size of an object so as to cause its apparent payload to leak
+ into the next one.
+ """
+ if encrypt is True:
+ # damage lowest bit of second least significant byte of size field;
+ # this effectively sets the ciphertext size to 422, causing it to
+ # extend over the next object into the third one.
+ return flip_bits (fname, crypto.HDR_OFF_CTSIZE + 1, b=0x01)
+ raise UndefinedTest ("corrupt_ctsize %s %s %s" % (fname, compress, encrypt))
+
+
def corrupt_entire_header (_, fname, compress, encrypt):
"""
Flip all bits in the first object header.
# to this point though
FAILURES = 1
+
+class RecoverCorruptHeaderCTSizeGZAESTest (RescueTest):
+ COMPRESSION = "#gz"
+ PASSWORD = TEST_PASSWORD
+ FAILURES = 0
+ CORRUPT = corrupt_ctsize
+ MISMATCHES = 0
+
+
###############################################################################
# index
###############################################################################