diff options
author | Gregory P. Smith <greg@krypto.org> | 2012-12-11 01:45:03 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2012-12-11 01:45:03 (GMT) |
commit | c0dd80e439bff4bd7cd9acc34ae023b4e8adf4aa (patch) | |
tree | 4aa75225df46ad589d2aebf0057d09c79dd60569 /Modules | |
parent | c474c4e7498e00249a85d973a608a86f4b56e7d5 (diff) | |
parent | 90555d0f0d0b8e4ffbbb37ba12a8e43020ad1e98 (diff) | |
download | cpython-c0dd80e439bff4bd7cd9acc34ae023b4e8adf4aa.zip cpython-c0dd80e439bff4bd7cd9acc34ae023b4e8adf4aa.tar.gz cpython-c0dd80e439bff4bd7cd9acc34ae023b4e8adf4aa.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 aa204d1..20a7d97 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; } |