When attempting to restore a saved image, the check for a valid save image format does not occur until the qemu process is about to be executed. Move the check earlier in the restore process, along with the other checks that verify a valid save image header. Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx> --- src/qemu/qemu_saveimage.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c index 76d9e96792..bcac6174ac 100644 --- a/src/qemu/qemu_saveimage.c +++ b/src/qemu/qemu_saveimage.c @@ -608,6 +608,12 @@ qemuSaveImageGetMetadata(virQEMUDriver *driver, return -1; } + if (header->format >= QEMU_SAVE_FORMAT_LAST) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("unsupported save image format: %1$d"), header->format); + return -1; + } + if (header->data_len <= 0) { virReportError(VIR_ERR_OPERATION_FAILED, _("invalid header data length: %1$d"), header->data_len); -- 2.43.0