[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in st
From: |
Luiz Capitulino |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()/strtoull() |
Date: |
Fri, 27 Apr 2012 10:06:16 -0300 |
On Fri, 27 Apr 2012 06:22:48 -0600
Eric Blake <address@hidden> wrote:
> On 04/27/2012 03:04 AM, Markus Armbruster wrote:
> > Luiz Capitulino <address@hidden> writes:
> >
> >> It's not checked currently, so something like:
> >>
>
> >> +++ b/monitor.c
> >> @@ -3120,10 +3120,17 @@ static int64_t expr_unary(Monitor *mon)
> >> n = 0;
> >> break;
> >> default:
> >> + errno = 0;
> >> #if TARGET_PHYS_ADDR_BITS > 32
> >> n = strtoull(pch, &p, 0);
> >> + if (n == ULLONG_MAX && errno == ERANGE) {
> >> + expr_error(mon, "number too large");
> >> + }
> >
> > The test n == ULLONG_MAX is redundant.
>
> But harmless.
Yes, and I prefer to comply to the standard (as there's no strong
reason not to do so).
Btw, I plan to add a wrapper like libvirt and convert qemu users.
- [Qemu-devel] [PATCH v2 0/2]: hmp: integer parsing fixes, Luiz Capitulino, 2012/04/26
- [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()/strtoull(), Luiz Capitulino, 2012/04/26
- Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()/strtoull(), Markus Armbruster, 2012/04/27
- Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()/strtoull(), Eric Blake, 2012/04/27
- Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()/strtoull(),
Luiz Capitulino <=
- Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()/strtoull(), Markus Armbruster, 2012/04/27
- Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()/strtoull(), Luiz Capitulino, 2012/04/27
- Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()/strtoull(), Eric Blake, 2012/04/27
- Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()/strtoull(), Luiz Capitulino, 2012/04/27
- Re: [Qemu-devel] [PATCH 1/2] hmp: expr_unary(): check for overflow in strtoul()/strtoull(), Markus Armbruster, 2012/04/27
[Qemu-devel] [PATCH 2/2] hmp: fix bad value conversion for M type, Luiz Capitulino, 2012/04/26