From: Gregory P. Smith Date: Tue, 11 Dec 2012 01:45:54 +0000 (-0800) Subject: 1 << 31 is invalid for signed integers, fix it by making 1 unsigned. X-Git-Tag: v2.7.4rc1~313 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=64ab35e11d9e2ad55f8a9ee69515f8901e184b59;p=thirdparty%2FPython%2Fcpython.git 1 << 31 is invalid for signed integers, fix it by making 1 unsigned. Found by Clang trunk's Undefined-Behavior Sanitizer. [more to come] --- diff --git a/Modules/_sre.c b/Modules/_sre.c index baf5f6a5a9c9..a5a6b1e8024e 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -459,7 +459,7 @@ SRE_CHARSET(SRE_CODE* set, SRE_CODE ch) } else { /* (32 bits per code word) */ - if (ch < 256 && (set[ch >> 5] & (1 << (ch & 31)))) + if (ch < 256 && (set[ch >> 5] & (1u << (ch & 31)))) return ok; set += 8; } @@ -498,7 +498,7 @@ SRE_CHARSET(SRE_CODE* set, SRE_CODE ch) block = -1; set += 64; if (block >=0 && - (set[block*8 + ((ch & 255)>>5)] & (1 << (ch & 31)))) + (set[block*8 + ((ch & 255)>>5)] & (1u << (ch & 31)))) return ok; set += count*8; }