From: Peter Krempa <pkre...@redhat.com>

Add debug statements which were useful in figuring out bugs in the qcow2
extension parser.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 src/storage_file/storage_file_probe.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/storage_file/storage_file_probe.c 
b/src/storage_file/storage_file_probe.c
index f5c50d4597..04a2dcd9aa 100644
--- a/src/storage_file/storage_file_probe.c
+++ b/src/storage_file/storage_file_probe.c
@@ -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)
-- 
2.49.0

Reply via email to