]> git.proxmox.com Git - mirror_qemu.git/commit
qcow2: Limit snapshot table size
authorKevin Wolf <kwolf@redhat.com>
Wed, 26 Mar 2014 12:06:07 +0000 (13:06 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 1 Apr 2014 13:22:35 +0000 (15:22 +0200)
commit5dae6e30c531feb31eed99f9039b52bf70832ce3
treec40240d9960565ac1cc88a3f6c72608ba3887388
parent6a83f8b5bec6f59e56cc49bd49e4c3f8f805d56f
qcow2: Limit snapshot table size

Even with a limit of 64k snapshots, each snapshot could have a filename
and an ID with up to 64k, which would still lead to pretty large
allocations, which could potentially lead to qemu aborting. Limit the
total size of the snapshot table to an average of 1k per entry when
the limit of 64k snapshots is fully used. This should be plenty for any
reasonable user.

This also fixes potential integer overflows of s->snapshot_size.

Suggested-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/qcow2-snapshot.c
block/qcow2.h