summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2015-08-04 23:29:00 (GMT)
committerGregory P. Smith <greg@krypto.org>2015-08-04 23:29:00 (GMT)
commit0a8572800b08ee2598d3db2b7b24bd3884ba11cd (patch)
tree05fdaefa9dbb2bd392ac6cca94e84e4163cc7d9f
parent937f2f70f5da95a3cfe72a0bdac91abad327a7bc (diff)
downloadcpython-0a8572800b08ee2598d3db2b7b24bd3884ba11cd.zip
cpython-0a8572800b08ee2598d3db2b7b24bd3884ba11cd.tar.gz
cpython-0a8572800b08ee2598d3db2b7b24bd3884ba11cd.tar.bz2
Don't left shift negative values. Use an unsigned value instead to avoid
undefined behavior.
-rw-r--r--Modules/cPickle.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 91f3ee7..89448a6 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -3448,7 +3448,7 @@ calc_binint(char *s, int x)
* to extend a BININT's sign bit to the full width.
*/
if (x == 4 && l & (1L << 31))
- l |= (~0L) << 32;
+ l |= (~0UL) << 32;
#endif
return l;
}