mirror of
https://github.com/kgabis/parson.git
synced 2024-11-24 06:05:29 +00:00
1.1.3: Ignoring floating point underflow (issue #161)
This commit is contained in:
parent
ab7f5e5401
commit
2d7b3ddf12
@ -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>)
|
||||
|
||||
|
@ -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" ],
|
||||
|
7
parson.c
7
parson.c
@ -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;
|
||||
|
2
parson.h
2
parson.h
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user