diff options
author | Gregory P. Smith <greg@krypto.org> | 2012-12-11 01:44:44 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2012-12-11 01:44:44 (GMT) |
commit | 90555d0f0d0b8e4ffbbb37ba12a8e43020ad1e98 (patch) | |
tree | 94b4ea0326d7f74517d8d4251ea2eaf3b82185d5 /Modules | |
parent | 87f9b46f15797efab3fc859112b3e8b0c3d893db (diff) | |
download | cpython-90555d0f0d0b8e4ffbbb37ba12a8e43020ad1e98.zip cpython-90555d0f0d0b8e4ffbbb37ba12a8e43020ad1e98.tar.gz cpython-90555d0f0d0b8e4ffbbb37ba12a8e43020ad1e98.tar.bz2 |
1 << 31 is invalid for signed integers, fix it by making 1 unsigned.
Found by Clang trunk's Undefined-Behavior Sanitizer. [more to come]
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_sre.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index 38d0127..d74bf44 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -452,7 +452,7 @@ SRE_CHARSET(SRE_CODE* set, SRE_CODE ch) } else { /* <CHARSET> <bitmap> (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; } @@ -491,7 +491,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; } |