From: Peter Krempa Date: Wed, 28 May 2025 08:00:34 +0000 (+0200) Subject: qcow2GetExtensions: Add debug logs for interesting fields in qcow2 header extension... X-Git-Tag: v11.5.0-rc1~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c97e2a98cd75d3b4c40c490815ee34f50566c79a;p=thirdparty%2Flibvirt.git qcow2GetExtensions: Add debug logs for interesting fields in qcow2 header extension parser 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 --- 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)