Re: [PATCH v2] qemu: Check the unsigned integer overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]