projects
/
platform
/
upstream
/
jsoncpp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
912d550
)
Remove undefined behavior from a left shift of a negative value.
author
Aaron Jacobs
<jacobsa@google.com>
Mon, 3 Aug 2015 00:58:29 +0000
(10:58 +1000)
committer
Aaron Jacobs
<jacobsa@google.com>
Mon, 3 Aug 2015 00:58:29 +0000
(10:58 +1000)
Fixed by shifting a positive value, then negating the result.
(Credit: Richard Trieu)
src/test_lib_json/main.cpp
patch
|
blob
|
history
diff --git
a/src/test_lib_json/main.cpp
b/src/test_lib_json/main.cpp
index
0d4284e
..
3641959
100644
(file)
--- a/
src/test_lib_json/main.cpp
+++ b/
src/test_lib_json/main.cpp
@@
-1212,7
+1212,7
@@
JSONTEST_FIXTURE(ValueTest, nonIntegers) {
JSONTEST_ASSERT_EQUAL(-2147483648.5, val.asDouble());
JSONTEST_ASSERT_EQUAL(float(-2147483648.5), val.asFloat());
#ifdef JSON_HAS_INT64
- JSONTEST_ASSERT_EQUAL(-
Json::Int64(1) << 31
, val.asLargestInt());
+ JSONTEST_ASSERT_EQUAL(-
(Json::Int64(1) << 31)
, val.asLargestInt());
#endif
JSONTEST_ASSERT_EQUAL(true, val.asBool());
JSONTEST_ASSERT_EQUAL("-2147483648.5",