From c97e2a98cd75d3b4c40c490815ee34f50566c79a Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 28 May 2025 10:00:34 +0200 Subject: [PATCH] qcow2GetExtensions: Add debug logs for interesting fields in qcow2 header extension parser MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add debug statements which were useful in figuring out bugs in the qcow2 extension parser. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- 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.47.3