Project

General

Profile

Actions

Bug #22512

closed

Overflow in `st_init_existing_table_with_size` / `Hash.new(capacity:)`

Bug #22512: Overflow in `st_init_existing_table_with_size` / `Hash.new(capacity:)`

Added by byroot (Jean Boussier) 11 days ago. Updated 6 days ago.

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

Description

If provided a large enough size, st_init_existing_table_with_size and Hash.new(capacity:) can overflow instead of raising, which could ultimately lead to a crash.

That being said, this bug isn't treated as a security vulnerability, because by design using an unstrusted number as a capacity open to DOS attacks regardless of the overflow.

Patch: https://github.com/ruby/ruby/pull/19773

Updated by byroot (Jean Boussier) 11 days ago Actions #1

  • Status changed from Open to Closed

Applied in changeset git|165bb8173f577bcef6103ba0ba19f7596efa23e5.


st.c: recompute MAX_POWER2

Remove the entries that would result in an overflow if allocated.

[Bug #22512]

Updated by tenderlovemaking (Aaron Patterson) 7 days ago Actions #3 [ruby-core:127425]

  • Backport changed from 3.3: WONTFIX, 3.4: REQUIRED, 4.0: REQUIRED to 3.3: WONTFIX, 3.4: REQUIRED, 4.0: DONE

ruby_4_0 67ddc4a20c merged revision(s) 165bb8173f.

Updated by nagachika (Tomoyuki Chikanaga) 6 days ago Actions #4 [ruby-core:127468]

  • Backport changed from 3.3: WONTFIX, 3.4: REQUIRED, 4.0: DONE to 3.3: WONTFIX, 3.4: DONE, 4.0: DONE
Actions

Also available in: PDF Atom