1.1.3: Ignoring floating point underflow (issue #161)

This commit is contained in:
Krzysztof Gabis 2021-05-26 14:01:51 +02:00
parent ab7f5e5401
commit 2d7b3ddf12
7 changed files with 11 additions and 5 deletions

View File

@ -3,7 +3,7 @@ project(parson C)
include (GNUInstallDirs)
set(PARSON_VERSION 1.1.2)
set(PARSON_VERSION 1.1.3)
add_library(parson parson.c)
target_include_directories(parson PUBLIC $<INSTALL_INTERFACE:include>)

View File

@ -1,6 +1,6 @@
{
"name": "parson",
"version": "1.1.2",
"version": "1.1.3",
"repo": "kgabis/parson",
"description": "Small json parser and reader",
"keywords": [ "json", "parser" ],

View File

@ -1,7 +1,7 @@
/*
SPDX-License-Identifier: MIT
Parson 1.1.2 ( http://kgabis.github.com/parson/ )
Parson 1.1.3 ( http://kgabis.github.com/parson/ )
Copyright (c) 2012 - 2021 Krzysztof Gabis
Permission is hereby granted, free of charge, to any person obtaining a copy
@ -864,7 +864,10 @@ static JSON_Value * parse_number_value(const char **string) {
double number = 0;
errno = 0;
number = strtod(*string, &end);
if (errno || !is_decimal(*string, end - *string)) {
if (errno == ERANGE && (number == -HUGE_VAL || number == HUGE_VAL)) {
return NULL;
}
if ((errno && errno != ERANGE) || !is_decimal(*string, end - *string)) {
return NULL;
}
*string = end;

View File

@ -1,7 +1,7 @@
/*
SPDX-License-Identifier: MIT
Parson 1.1.2 ( http://kgabis.github.com/parson/ )
Parson 1.1.3 ( http://kgabis.github.com/parson/ )
Copyright (c) 2012 - 2021 Krzysztof Gabis
Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -10,6 +10,7 @@
"hard to parse number" : -3.14e-4,
"big int": 2147483647,
"big uint": 4294967295,
"double underflow": 6.9041432094973937e-310,
"boolean true" : true,
"boolean false" : false,
"null" : null,

View File

@ -16,6 +16,7 @@
"hard to parse number" : -3.14e-4,
"big int": 2147483647,
"big uint": 4294967295,
"double underflow": 6.9041432094973937e-310,
"boolean true" : true,
"boolean false" : false,
"null" : null,

View File

@ -10,6 +10,7 @@
"hard to parse number": -0.00031399999999999999,
"big int": 2147483647,
"big uint": 4294967295,
"double underflow": 6.9041432094973937e-310,
"boolean true": true,
"boolean false": false,
"null": null,