Re: [Qemu-devel] [PATCH 06/10] json-parser: fix handling of large whole number values

2013-05-10 Thread mdroth
On Fri, May 10, 2013 at 11:17:17AM -0400, Luiz Capitulino wrote: > On Thu, 9 May 2013 21:20:58 -0500 > Michael Roth wrote: > > > Currently our JSON parser assumes that numbers lacking a mantissa are > > integers and attempts to store them as QInt/int64 values. This breaks in > > the case where t

Re: [Qemu-devel] [PATCH 06/10] json-parser: fix handling of large whole number values

2013-05-10 Thread Luiz Capitulino
On Thu, 9 May 2013 21:20:58 -0500 Michael Roth wrote: > Currently our JSON parser assumes that numbers lacking a mantissa are > integers and attempts to store them as QInt/int64 values. This breaks in > the case where the number overflows/underflows int64 values (which is > still valid JSON) An

Re: [Qemu-devel] [PATCH 06/10] json-parser: fix handling of large whole number values

2013-05-10 Thread mdroth
On Fri, May 10, 2013 at 08:08:05AM -0600, Eric Blake wrote: > On 05/10/2013 06:47 AM, Laszlo Ersek wrote: > > > The pre-patch code for JSON_INTEGER: > > > > obj = QOBJECT(qint_from_int(strtoll(token_get_value(token), NULL, 10))); > > > > doesn't check for errors at all. (I assume that JSON_INTEG

Re: [Qemu-devel] [PATCH 06/10] json-parser: fix handling of large whole number values

2013-05-10 Thread Eric Blake
On 05/10/2013 06:47 AM, Laszlo Ersek wrote: > The pre-patch code for JSON_INTEGER: > > obj = QOBJECT(qint_from_int(strtoll(token_get_value(token), NULL, 10))); > > doesn't check for errors at all. (I assume that JSON_INTEGER is selected > by the parser, token_get_type(), based on syntax purely.)

Re: [Qemu-devel] [PATCH 06/10] json-parser: fix handling of large whole number values

2013-05-10 Thread mdroth
On Fri, May 10, 2013 at 02:47:18PM +0200, Laszlo Ersek wrote: > On 05/10/13 14:22, Eric Blake wrote: > > On 05/09/2013 08:20 PM, Michael Roth wrote: > >> Currently our JSON parser assumes that numbers lacking a mantissa are > >> integers and attempts to store them as QInt/int64 values. This breaks

Re: [Qemu-devel] [PATCH 06/10] json-parser: fix handling of large whole number values

2013-05-10 Thread Laszlo Ersek
On 05/10/13 14:22, Eric Blake wrote: > On 05/09/2013 08:20 PM, Michael Roth wrote: >> Currently our JSON parser assumes that numbers lacking a mantissa are >> integers and attempts to store them as QInt/int64 values. This breaks in >> the case where the number overflows/underflows int64 values (whi

Re: [Qemu-devel] [PATCH 06/10] json-parser: fix handling of large whole number values

2013-05-10 Thread Eric Blake
On 05/09/2013 08:20 PM, Michael Roth wrote: > Currently our JSON parser assumes that numbers lacking a mantissa are > integers and attempts to store them as QInt/int64 values. This breaks in > the case where the number overflows/underflows int64 values (which is > still valid JSON) > > Fix this by

Re: [Qemu-devel] [PATCH 06/10] json-parser: fix handling of large whole number values

2013-05-10 Thread Laszlo Ersek
On 05/10/13 04:20, Michael Roth wrote: > Currently our JSON parser assumes that numbers lacking a mantissa are > integers and attempts to store them as QInt/int64 values. This breaks in > the case where the number overflows/underflows int64 values (which is > still valid JSON) > > Fix this by dete

[Qemu-devel] [PATCH 06/10] json-parser: fix handling of large whole number values

2013-05-09 Thread Michael Roth
Currently our JSON parser assumes that numbers lacking a mantissa are integers and attempts to store them as QInt/int64 values. This breaks in the case where the number overflows/underflows int64 values (which is still valid JSON) Fix this by detecting such cases and using a QFloat to store the va