From 583224f63feb2df42eea78f3dfec2e9dc7c7f69e Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Sun, 17 Oct 2010 20:43:40 +0200 Subject: [PATCH] migration: don't segfault on invalid input host_from_stream_offset returns NULL on error, return error instead of trying to use that address, to avoid segfault on invalid stream. Signed-off-by: Michael S. Tsirkin --- arch_init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch_init.c b/arch_init.c index a910033..4caadd0 100644 --- a/arch_init.c +++ b/arch_init.c @@ -390,6 +390,9 @@ int ram_load(QEMUFile *f, void *opaque, int version_id) host = qemu_get_ram_ptr(addr); else host = host_from_stream_offset(f, addr, flags); + if (!host) { + return -EINVAL; + } ch = qemu_get_byte(f); memset(host, ch, TARGET_PAGE_SIZE); -- 2.7.4