[libvirt] [PATCH v2] qemu: Check the unsigned integer overflow
Eric Blake
eblake at redhat.com
Tue Mar 15 03:27:40 UTC 2011
On 03/09/2011 01:34 AM, Osier Yang wrote:
> As perhaps other hypervisor drivers use different capacity units,
> do the checking in qemu driver instead of in conf/domain_conf.c.
> ---
> src/qemu/qemu_command.c | 14 ++++++++++++++
> 1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 198a4e2..59fd2ac 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1933,6 +1933,13 @@ qemuBuildVideoDevStr(virDomainVideoDefPtr video,
> virBufferVSprintf(&buf, ",id=%s", video->info.alias);
>
> if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
> + if (video->vram > (UINT_MAX / 1024)) {
> + qemuReportError(VIR_ERR_INTERNAL_ERROR,
Wrong error. That's a user-supplied value, so it's not an internal
error. Better would be VIR_ERR_INVALID_ARG.
> if (def->videos[0]->vram &&
> qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
> + if (def->videos[0]->vram > (UINT_MAX / 1024)) {
> + qemuReportError(VIR_ERR_INTERNAL_ERROR,
Again.
ACK with those nits fixed.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110314/f1f5bd64/attachment-0001.sig>
More information about the libvir-list
mailing list