From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtJfj-00075B-Sq for qemu-devel@nongnu.org; Tue, 25 Nov 2014 12:13:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XtJfe-0003Yo-FV for qemu-devel@nongnu.org; Tue, 25 Nov 2014 12:13:03 -0500 From: Kevin Wolf Date: Tue, 25 Nov 2014 18:12:41 +0100 Message-Id: <1416935562-7760-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1416935562-7760-1-git-send-email-kwolf@redhat.com> References: <1416935562-7760-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH v2 2/3] qcow2.py: Add required padding for header extensions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-stable@nongnu.org, armbru@redhat.com, stefanha@redhat.com, mreitz@redhat.com The qcow2 specification requires that the header extension data be padded to round up the extension size to the next multiple of 8 bytes. Signed-off-by: Kevin Wolf --- tests/qemu-iotests/qcow2.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py index 2058596..9cc4cf7 100755 --- a/tests/qemu-iotests/qcow2.py +++ b/tests/qemu-iotests/qcow2.py @@ -7,6 +7,10 @@ import string class QcowHeaderExtension: def __init__(self, magic, length, data): + if length % 8 != 0: + padding = 8 - (length % 8) + data += "\0" * padding + self.magic = magic self.length = length self.data = data -- 1.8.3.1