Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
d9106722
Commit
d9106722
authored
Oct 13, 2016
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added missing overflow check for #329
parent
67b9f193
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
1 deletion
+21
-1
README.md
README.md
+1
-1
json.hpp
src/json.hpp
+7
-0
json.hpp.re2c
src/json.hpp.re2c
+7
-0
unit-regression.cpp
test/src/unit-regression.cpp
+6
-0
No files found.
README.md
View file @
d9106722
...
@@ -516,7 +516,7 @@ To compile and run the tests, you need to execute
...
@@ -516,7 +516,7 @@ To compile and run the tests, you need to execute
$ make check
$ make check
===============================================================================
===============================================================================
All tests passed (890516
8
assertions in 35 test cases)
All tests passed (890516
9
assertions in 35 test cases)
```
```
Alternatively, you can use [https://cmake.org](CMake) and run
Alternatively, you can use [https://cmake.org](CMake) and run
...
...
src/json.hpp
View file @
d9106722
...
@@ -8960,6 +8960,13 @@ basic_json_parser_63:
...
@@ -8960,6 +8960,13 @@ basic_json_parser_63:
{
{
// parse with strtod
// parse with strtod
result
.
m_value
.
number_float
=
str_to_float_t
(
static_cast
<
number_float_t
*>
(
nullptr
),
NULL
);
result
.
m_value
.
number_float
=
str_to_float_t
(
static_cast
<
number_float_t
*>
(
nullptr
),
NULL
);
// replace infinity and NAN by null
if
(
not
std
::
isfinite
(
result
.
m_value
.
number_float
))
{
type
=
value_t
::
null
;
result
.
m_value
=
basic_json
::
json_value
();
}
}
}
// save the type
// save the type
...
...
src/json.hpp.re2c
View file @
d9106722
...
@@ -8257,6 +8257,13 @@ class basic_json
...
@@ -8257,6 +8257,13 @@ class basic_json
{
{
// parse with strtod
// parse with strtod
result.m_value.number_float = str_to_float_t(static_cast<number_float_t*>(nullptr), NULL);
result.m_value.number_float = str_to_float_t(static_cast<number_float_t*>(nullptr), NULL);
// replace infinity and NAN by null
if (not std::isfinite(result.m_value.number_float))
{
type = value_t::null;
result.m_value = basic_json::json_value();
}
}
}
// save the type
// save the type
...
...
test/src/unit-regression.cpp
View file @
d9106722
...
@@ -489,4 +489,10 @@ TEST_CASE("regression tests")
...
@@ -489,4 +489,10 @@ TEST_CASE("regression tests")
j
[
"/this/that"
_json_pointer
]
=
27
;
j
[
"/this/that"
_json_pointer
]
=
27
;
CHECK
(
j
==
json
({{
"this"
,
{{
"that"
,
27
}}}}));
CHECK
(
j
==
json
({{
"this"
,
{{
"that"
,
27
}}}}));
}
}
SECTION
(
"issue #329 - serialized value not always can be parsed"
)
{
json
j
=
json
::
parse
(
"22e2222"
);
CHECK
(
j
==
json
());
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment