Project

General

Profile

Actions

Bug #19323

closed

Integer overflow in `Integer#<<`

Added by nobu (Nobuyoshi Nakada) almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:111735]

Description

require 'rbconfig/sizeof'
char_bit = RbConfig::LIMITS["UCHAR_MAX"].bit_length
size_max = RbConfig::LIMITS["SIZE_MAX"]
size_bit_max = size_max * char_bit
1 << size_bit_max

The above code raises an "integer overflow" error.

-:5:in `<<': integer overflow: 4611686018427387905 * 4 > 18446744073709551615 (ArgumentError)
	from -:5:in `<main>'

It doesn't seem like a proper or intentional exception.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #18518: NoMemoryError + [FATAL] failed to allocate memory for twice 1 << largeRejectedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0