Commit ac3b1c4c authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

lshift must not assume sizeof(long) >= sizeof(mrb_int)

parent 19cd9c6e
......@@ -949,8 +949,7 @@ fix_xor(mrb_state *mrb, mrb_value x)
static mrb_value
lshift(mrb_state *mrb, mrb_int val, unsigned long width)
{
if (width > (sizeof(mrb_int)*CHAR_BIT-1)
|| ((unsigned long)abs(val))>>(sizeof(mrb_int)*CHAR_BIT-1-width) > 0) {
if (width > (sizeof(mrb_int)*CHAR_BIT-1)) {
mrb_raise(mrb, E_RANGE_ERROR, "width(%d) > (%d:sizeof(mrb_int)*CHAR_BIT-1)", width,
sizeof(mrb_int)*CHAR_BIT-1);
}
......
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