diff options
author | Gregory P. Smith <greg@krypto.org> | 2012-12-11 01:45:16 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2012-12-11 01:45:16 (GMT) |
commit | 60112ae319c5d95e74dafe6c67c04d01f50d965a (patch) | |
tree | 237f40a2a256c08ba2ff8ce39f8a94ac71f15303 /Modules/_sre.c | |
parent | 6c722c6df464f327784e34191ea43d79d7e99f94 (diff) | |
parent | c0dd80e439bff4bd7cd9acc34ae023b4e8adf4aa (diff) | |
download | cpython-60112ae319c5d95e74dafe6c67c04d01f50d965a.zip cpython-60112ae319c5d95e74dafe6c67c04d01f50d965a.tar.gz cpython-60112ae319c5d95e74dafe6c67c04d01f50d965a.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/_sre.c')
-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 a65afc4..82a1b9c 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -427,7 +427,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; } @@ -466,7 +466,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; } |