aa33db6903 (master): Pass the buffer's size to ruby_xrealloc_sized, not the field distance

0 views
Skip to first unread message

Koichi Sasada

unread,
1:22 PM (11 hours ago) 1:22 PM
to ruby...@g.ruby-lang.org
Koichi Sasada 2026-08-30 14:59:24 +0000 (Sun, 30 Aug 2026)

New Revision: aa33db6903

https://github.com/ruby/ruby/commit/aa33db6903

Log:
Pass the buffer's size to ruby_xrealloc_sized, not the field distance

rb_econv_insert_output() grew the insertion buffer with

ruby_xrealloc_sized(*buf_start_p, s, buf_end_p - buf_start_p);

The old-size argument subtracts the two local pointer variables instead
of the pointers they point at, so the allocator's size accounting gets a
small constant rather than the buffer's size. Present since the sized
variant was introduced; the memory itself was never corrupted.

Co-Authored-By: Claude Opus 5 <nor...@anthropic.com>

Modified files:
test/ruby/test_transcode.rb
transcode.c
Reply all
Reply to author
Forward
0 new messages