Estimate real number underflows with 0.0
Earlier it was a decoding error.
This commit is contained in:
parent
f76966b438
commit
bb89a5d4d3
@ -483,14 +483,7 @@ static int lex_scan_number(lex_t *lex, char c, json_error_t *error)
|
||||
value = strtod(saved_text, &end);
|
||||
assert(end == saved_text + lex->saved_text.length);
|
||||
|
||||
if(value == 0 && errno == ERANGE) {
|
||||
error_set(error, lex, "real number underflow");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Cannot test for +/-HUGE_VAL because the HUGE_VAL constant is
|
||||
only defined in C99 mode. So let's trust in sole errno. */
|
||||
else if(errno == ERANGE) {
|
||||
if(errno == ERANGE && value != 0) {
|
||||
error_set(error, lex, "real number overflow");
|
||||
goto out;
|
||||
}
|
||||
|
@ -1,2 +0,0 @@
|
||||
1
|
||||
real number underflow near '123e-10000000'
|
@ -1,2 +0,0 @@
|
||||
1
|
||||
real number underflow near '123e-10000000'
|
1
test/suites/valid-strip/real-underflow/output
Normal file
1
test/suites/valid-strip/real-underflow/output
Normal file
@ -0,0 +1 @@
|
||||
[0.0]
|
1
test/suites/valid/real-underflow/output
Normal file
1
test/suites/valid/real-underflow/output
Normal file
@ -0,0 +1 @@
|
||||
[0.0]
|
Loading…
Reference in New Issue
Block a user