Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
808d362b
Commit
808d362b
authored
Jul 30, 2014
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix parsing numbers which are less than 1e-308
Overflow should check sign of exponent.
parent
c4f64e7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
1 deletion
+2
-1
reader.h
include/rapidjson/reader.h
+1
-1
readertest.cpp
test/unittest/readertest.cpp
+1
-0
No files found.
include/rapidjson/reader.h
View file @
808d362b
...
...
@@ -796,7 +796,7 @@ private:
exp
=
s
.
Take
()
-
'0'
;
while
(
s
.
Peek
()
>=
'0'
&&
s
.
Peek
()
<=
'9'
)
{
exp
=
exp
*
10
+
(
s
.
Take
()
-
'0'
);
if
(
exp
>
308
)
if
(
exp
>
308
&&
!
expMinus
)
// exp > 308 should be rare, so it should be checked first.
RAPIDJSON_PARSE_ERROR
(
kParseErrorNumberTooBig
,
s
.
Tell
());
}
}
...
...
test/unittest/readertest.cpp
View file @
808d362b
...
...
@@ -137,6 +137,7 @@ TEST(Reader, ParseNumberHandler) {
TEST_DOUBLE
(
"2.22507e-308"
,
2.22507e-308
);
TEST_DOUBLE
(
"-1.79769e+308"
,
-
1.79769e+308
);
TEST_DOUBLE
(
"-2.22507e-308"
,
-
2.22507e-308
);
TEST_DOUBLE
(
"4.9406564584124654e-324"
,
4.9406564584124654e-324
);
// minimum denormal
TEST_DOUBLE
(
"18446744073709551616"
,
18446744073709551616.0
);
// 2^64 (max of uint64_t + 1, force to use double)
TEST_DOUBLE
(
"-9223372036854775809"
,
-
9223372036854775809.0
);
// -2^63 - 1(min of int64_t + 1, force to use double)
...
...
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