Skip to content

Commit

Permalink
Fix the undefined behaviour when negating the minimum value integers …
Browse files Browse the repository at this point in the history
…in Reader
  • Loading branch information
miloyip committed May 21, 2015
1 parent f688b2b commit 1a570c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/rapidjson/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -967,13 +967,13 @@ class GenericReader {
else {
if (use64bit) {
if (minus)
cont = handler.Int64(-(int64_t)i64);
cont = handler.Int64(static_cast<int64_t>(~i64 + 1));
else
cont = handler.Uint64(i64);
}
else {
if (minus)
cont = handler.Int(-(int)i);
cont = handler.Int(static_cast<int32_t>(~i + 1));
else
cont = handler.Uint(i);
}
Expand Down

0 comments on commit 1a570c3

Please sign in to comment.