summaryrefslogtreecommitdiffstats
path: root/Modules/_sre.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2012-12-11 01:45:54 (GMT)
committerGregory P. Smith <greg@krypto.org>2012-12-11 01:45:54 (GMT)
commit64ab35e11d9e2ad55f8a9ee69515f8901e184b59 (patch)
tree155f4ed7e32974b28743c795f4bcb3f21421db86 /Modules/_sre.c
parent33b9b71e8dbddf081bd5e7dbf65166ca5d4d75c2 (diff)
downloadcpython-64ab35e11d9e2ad55f8a9ee69515f8901e184b59.zip
cpython-64ab35e11d9e2ad55f8a9ee69515f8901e184b59.tar.gz
cpython-64ab35e11d9e2ad55f8a9ee69515f8901e184b59.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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index baf5f6a..a5a6b1e 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -459,7 +459,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;
}
@@ -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;
}