On 03/08/2013 09:56 AM, Lei Li wrote:
> Signed-off-by: Lei Li <[email protected]>
> ---
>  qga/commands-win32.c |   35 +++++++++++++++++++++++++++++++++++
>  1 files changed, 35 insertions(+), 0 deletions(-)
> 

> +
> +    time = time_ns / 100 + W32_FT_OFFSET;
> +    /* FILETIME values should be less than 0x8000000000000000
> +       for function FileTimeToSystemTime. */
> +    if (time & 0x8000000000000000) {
> +        error_setg(errp, "Time %" PRId64 "is too large", time);
> +        return;
> +    }

That doesn't cover all cases of overflow.  Better would be:

if (time_ns < 0 || time_ns / 100 > INT64_MAX - W32_FT_OFFSET) {
    error ...
}
time = time_ns / 100 + W32_FT_OFFSET;

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to