Skip to content

Commit 75eb0f5

Browse files
kevmwmdroth
authored andcommitted
qcow2.py: Add required padding for header extensions
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 <[email protected]> Reviewed-by: Max Reitz <[email protected]> Message-id: [email protected] Signed-off-by: Stefan Hajnoczi <[email protected]> Signed-off-by: Kevin Wolf <[email protected]> (cherry picked from commit 8884dd1) Signed-off-by: Michael Roth <[email protected]> (cherry picked from commit a163ac3f57b5baa117158f7c0488d276ba3377e2) Signed-off-by: Michael Roth <[email protected]>
1 parent b495764 commit 75eb0f5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/qemu-iotests/qcow2.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
class QcowHeaderExtension:
88

99
def __init__(self, magic, length, data):
10+
if length % 8 != 0:
11+
padding = 8 - (length % 8)
12+
data += "\0" * padding
13+
1014
self.magic = magic
1115
self.length = length
1216
self.data = data

0 commit comments

Comments
 (0)