[Python-checkins] cpython (2.7): 1 << 31 is invalid for signed integers, fix it by making 1 unsigned.
gregory.p.smith
python-checkins at python.org
Tue Dec 11 02:52:07 CET 2012
http://hg.python.org/cpython/rev/6c8a7469670b
changeset: 80818:6c8a7469670b
branch: 2.7
parent: 80795:37c1d20facd7
user: Gregory P. Smith <greg at krypto.org>
date: Mon Dec 10 17:45:54 2012 -0800
summary:
1 << 31 is invalid for signed integers, fix it by making 1 unsigned.
Found by Clang trunk's Undefined-Behavior Sanitizer. [more to come]
files:
Modules/_sre.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Modules/_sre.c b/Modules/_sre.c
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -459,7 +459,7 @@
}
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 @@
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;
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list