]> granicus.if.org Git - python/commitdiff
Don't left shift negative values. Use an unsigned value instead to avoid
authorGregory P. Smith <greg@krypto.org>
Tue, 4 Aug 2015 23:29:00 +0000 (16:29 -0700)
committerGregory P. Smith <greg@krypto.org>
Tue, 4 Aug 2015 23:29:00 +0000 (16:29 -0700)
undefined behavior.

Modules/cPickle.c

index 91f3ee7bd5a0e710522ba9286104c697dc2f8e55..89448a6f419002fff3b1a302628c2ca11139c5a3 100644 (file)
@@ -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;
 }