# SPDX-License-Identifier: MPL-2.0 """Decode the read-only TUNRAW1 stream; reject truncation and overlapping blocks.""" import struct def exact(stream, length): data=bytearray() while len(data)65536 or offset+length>expected_size:raise ValueError('Invalid backup extent') target.seek(offset);target.write(exact(stream,length));end=offset+length