]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qcow2GetExtensions: Add debug logs for interesting fields in qcow2 header extension...
authorPeter Krempa <pkrempa@redhat.com>
Wed, 28 May 2025 08:00:34 +0000 (10:00 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 3 Jun 2025 11:11:02 +0000 (13:11 +0200)
Add debug statements which were useful in figuring out bugs in the qcow2
extension parser.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/storage_file/storage_file_probe.c

index f5c50d4597bf390355adea4fe7b6f933b26d5d42..04a2dcd9aa807365c4ea3220b6272adde270303f 100644 (file)
@@ -442,6 +442,10 @@ qcow2GetExtensions(const char *buf,
      * is stored at QCOW2v3_HDR_SIZE
      */
     extension_end = virReadBufInt64BE(buf + QCOWX_HDR_BACKING_FILE_OFFSET);
+
+    VIR_DEBUG("extension_start:%zu, extension_end:%zu, buf_size:%zu",
+              extension_start, extension_end, buf_size);
+
     if (extension_end > buf_size)
         return -1;
 
@@ -461,6 +465,8 @@ qcow2GetExtensions(const char *buf,
         unsigned int magic = virReadBufInt32BE(buf + offset);
         unsigned int len = virReadBufInt32BE(buf + offset + 4);
 
+        VIR_DEBUG("offset:%zu, len:%u, magic:0x%x", offset, len, magic);
+
         offset += 8;
 
         if ((offset + len) < offset)