Project

General

Profile

Actions

Bug #19284

closed

Integer overflow when using RUBY_GC_HEAP_INIT_SLOTS environment variable

Added by zeke (Zeke Gabrielse) about 1 year ago. Updated about 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-darwin19]
[ruby-core:111510]

Description

If you set the environment variable RUBY_GC_HEAP_INIT_SLOTS to anything other than 0, an integer overflow runtime error occurs:

RUBY_GC_HEAP_INIT_SLOTS=10000 ruby -e 'puts "hello, world!"'
# => ruby: integer overflow: 3689348814741910508 * 8 > 18446744073709551615 (RuntimeError)

At this time, I'm not sure if this is platform-specific, but it's failing on Darwin as well as Heroku's environment (Linux).


Related issues 1 (0 open1 closed)

Has duplicate Ruby master - Bug #19358: Segfault when setting RUBY_GC_HEAP_INIT_SLOTS to a low valueClosedActions
Actions #1

Updated by zeke (Zeke Gabrielse) about 1 year ago

  • Description updated (diff)
Actions #2

Updated by zeke (Zeke Gabrielse) about 1 year ago

  • Description updated (diff)
Actions #3

Updated by zeke (Zeke Gabrielse) about 1 year ago

  • Description updated (diff)

Updated by peterzhu2118 (Peter Zhu) about 1 year ago

  • Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED

Thank you for reporting this bug. I have a fix here: https://github.com/ruby/ruby/pull/7044

Actions #5

Updated by peterzhu2118 (Peter Zhu) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset git|90a80eb076429978e720e11fb17a3cbb96de3454.


Fix integer underflow when using HEAP_INIT_SLOTS

There is an integer underflow when the environment variable
RUBY_GC_HEAP_INIT_SLOTS is less than the number of slots currently
in the Ruby heap.

[Bug #19284]

Updated by naruse (Yui NARUSE) about 1 year ago

  • Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONE

ruby_3_2 49cf0896a2934547c0764aadaec021fb37a2e96f merged revision(s) 90a80eb076429978e720e11fb17a3cbb96de3454.

Actions #7

Updated by peterzhu2118 (Peter Zhu) about 1 year ago

  • Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONE to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE
Actions #8

Updated by peterzhu2118 (Peter Zhu) about 1 year ago

  • Related to Bug #19358: Segfault when setting RUBY_GC_HEAP_INIT_SLOTS to a low value added
Actions #9

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Related to deleted (Bug #19358: Segfault when setting RUBY_GC_HEAP_INIT_SLOTS to a low value)
Actions #10

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Has duplicate Bug #19358: Segfault when setting RUBY_GC_HEAP_INIT_SLOTS to a low value added

Updated by nagachika (Tomoyuki Chikanaga) about 1 year ago

  • Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: REQUIRED, 3.2: DONE to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONE, 3.2: DONE

ruby_3_1 782a9c2ddfcc84c3bd3a1fa153f7ac1f3e92a2e1 merged revision(s) 90a80eb076429978e720e11fb17a3cbb96de3454.

Updated by nagachika (Tomoyuki Chikanaga) about 1 year ago

I have backported 0bb07e5ba40cdc45d55743dd1ebaadd7e7363e7f to fix test failures in RubyCI.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0