Return rb_len_t from rb_RSTRING_LEN

unsigned long can be narrower than rb_len_t, which would truncate the length that YJIT and ZJIT read through this function.

https://bugs.ruby-lang.org/issues/22400

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hiroshi SHIBATAandClaude Opus 5.5 committed 2026-10-10 17:21:06 +09:00
1 parent 9f3a5c227c
commit 05917fd1e6
3 files changed
+3 -3
Notes: git 2026-10-10 08:21:39 +00:00

No files matched your search

+1 -1
View File
@@ -108,7 +108,7 @@ rb_iseq_bare_opcode_at_pc(const rb_iseq_t *iseq, const VALUE *pc)
return rb_vm_insn_addr2insn((const void *)at_pc);
}
unsigned long
rb_len_t
rb_RSTRING_LEN(VALUE str)
{
return RSTRING_LEN(str);
+1 -1
View File
@@ -1303,7 +1303,7 @@ extern "C" {
pub fn rb_iseq_encoded_size(iseq: *const rb_iseq_t) -> ::std::os::raw::c_uint;
pub fn rb_iseq_pc_at_idx(iseq: *const rb_iseq_t, insn_idx: u32) -> *mut VALUE;
pub fn rb_iseq_opcode_at_pc(iseq: *const rb_iseq_t, pc: *const VALUE) -> ::std::os::raw::c_int;
pub fn rb_RSTRING_LEN(str_: VALUE) -> ::std::os::raw::c_ulong;
pub fn rb_RSTRING_LEN(str_: VALUE) -> rb_len_t;
pub fn rb_RSTRING_PTR(str_: VALUE) -> *mut ::std::os::raw::c_char;
pub fn rb_insn_name(insn: VALUE) -> *const ::std::os::raw::c_char;
pub fn rb_vm_ci_argc(ci: *const rb_callinfo) -> ::std::os::raw::c_uint;
+1 -1
View File
@@ -2505,7 +2505,7 @@ unsafe extern "C" {
iseq: *const rb_iseq_t,
pc: *const VALUE,
) -> ::std::os::raw::c_int;
pub fn rb_RSTRING_LEN(str_: VALUE) -> ::std::os::raw::c_ulong;
pub fn rb_RSTRING_LEN(str_: VALUE) -> rb_len_t;
pub fn rb_RSTRING_PTR(str_: VALUE) -> *mut ::std::os::raw::c_char;
pub fn rb_insn_name(insn: VALUE) -> *const ::std::os::raw::c_char;
pub fn rb_vm_ci_argc(ci: *const rb_callinfo) -> ::std::os::raw::c_uint;