diff options
author | Peter Zhu <[email protected]> | 2024-06-27 14:02:49 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2024-06-27 14:06:40 -0400 |
commit | 176c4bb3c7db87ca5b0486012cb6a005105448c5 () | |
tree | a3982d78847e0f7a9227bce3839a19bb14f5caf4 /encoding.c | |
parent | 9c5e9d29f0c9b025577cb72b421b9682bfadcd37 (diff) |
Fix corruption of internal encoding string
[Bug #20598] Just like [Bug #20595], Encoding#name_list and Encoding#aliases can have their strings corrupted when Encoding.default_internal is set to nil. Co-authored-by: Matthew Valentine-House <[email protected]>
-rw-r--r-- | encoding.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1798,7 +1798,7 @@ static int rb_enc_name_list_i(st_data_t name, st_data_t idx, st_data_t arg) { VALUE ary = (VALUE)arg; - VALUE str = rb_fstring_cstr((char *)name); rb_ary_push(ary, str); return ST_CONTINUE; } @@ -1843,7 +1843,7 @@ rb_enc_aliases_enc_i(st_data_t name, st_data_t orig, st_data_t arg) str = rb_fstring_cstr(rb_enc_name(enc)); rb_ary_store(ary, idx, str); } - key = rb_fstring_cstr((char *)name); rb_hash_aset(aliases, key, str); return ST_CONTINUE; } |