From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUd1d-0001dY-7r for qemu-devel@nongnu.org; Mon, 31 Mar 2014 10:17:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUd1X-0000pB-Sh for qemu-devel@nongnu.org; Mon, 31 Mar 2014 10:17:21 -0400 Date: Mon, 31 Mar 2014 17:17:40 +0300 From: "Michael S. Tsirkin" Message-ID: <1396275242-10810-27-git-send-email-mst@redhat.com> References: <1396275242-10810-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1396275242-10810-1-git-send-email-mst@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v4 26/30] savevm: fix potential segfault on invalid state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mdroth@linux.vnet.ibm.com, Juan Quintela , Alexey Kardashevskiy , qemu-stable@nongnu.org, dgilbert@redhat.com, =?us-ascii?B?PT9VVEYtOD9xP0FuZHJlYXM9MjBGPUMzPUE0cmJlcj89?= savevm will segfault if version_id < vmsd->minimum_version_id && version_id >=3D vmsd->minimum_version_id_old This calls through a NULL pointer. This is a bug (should exit not crash). Reviewed-by: Andreas F=E4rber Signed-off-by: Michael S. Tsirkin --- vmstate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vmstate.c b/vmstate.c index e1e9cae..5451fd2 100644 --- a/vmstate.c +++ b/vmstate.c @@ -67,6 +67,9 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, return -EINVAL; } if (version_id < vmsd->minimum_version_id) { + if (!vmsd->load_state_old) { + return -EINVAL; + } return vmsd->load_state_old(f, opaque, version_id); } if (vmsd->pre_load) { --=20 MST