Commit 90555d0f authored by Gregory P. Smith's avatar Gregory P. Smith

1 << 31 is invalid for signed integers, fix it by making 1 unsigned.

Found by Clang trunk's Undefined-Behavior Sanitizer.  [more to come]
parent 87f9b46f
......@@ -452,7 +452,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;
}
......@@ -491,7 +491,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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment