Re: [PATCH 1/2] qemu-JSON: Error out if number is out of range instead of overflowing to negative

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

 



On 04/03/2013 02:46 AM, Peter Krempa wrote:
> Commit 78eb8b60d59662271c4a9a1be8c9002ee84dc8cf works around qemu's inability to
> parse unsigned 64 bit integers by representing them as signed. This introduces a
> bug where if the requested integer is greater than LLONG_MAX the result is
> wrapped to negative numbers.

But then qemu, on the receiving end, turns the negative number back into
the appropriate bit pattern for an unsigned value, which lets us get
around the fact that passing a positive unsigned value > LLONG_MAX would
be truncated.

> 
> This patch adds a check to avoid the wrap for unsigned numbers and error out
> rather than passing them along.
> ---
>  src/qemu/qemu_monitor_json.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

This would prevent us from sending bit patterns that qemu will interpret
correctly, even if the JSON used in sending the bit pattern is expressed
as a negative number, where we could previously send such a pattern.
I'm inclined to NACK this patch; unless you have a more concrete example
of qemu no longer interpreting a negative string as the correct unsigned
bit value.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
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]