Commit 492fb99c authored by Michael S. Tsirkin's avatar Michael S. Tsirkin

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: default avatarMichael S. Tsirkin <>
parent c57c846a
......@@ -390,6 +390,9 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
host = qemu_get_ram_ptr(addr);
host = host_from_stream_offset(f, addr, flags);
if (!host) {
return -EINVAL;
ch = qemu_get_byte(f);
memset(host, ch, TARGET_PAGE_SIZE);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment