mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
1 << 31 is invalid for signed integers, fix it by making 1 unsigned.
Found by Clang trunk's Undefined-Behavior Sanitizer. [more to come]
This commit is contained in:
commit
60112ae319
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue