diff options
author | Jean Boussier <[email protected]> | 2021-09-01 09:43:39 +0100 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2021-09-15 08:00:18 +0900 |
commit | 89242279e61b023a81c58065c62a82de8829d0b3 (patch) | |
tree | 25cb8c6e3520470c94c633e80e4b3bb4b192a1f5 /marshal.c | |
parent | a0357acf197dcdb504dd97af39103dd8c68f53b3 (diff) |
Marshal.load: do not call the proc until strings have their encoding
Ref: https://bugs.ruby-lang.org/issues/18141
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4797
Diffstat (limited to 'marshal.c')
-rw-r--r-- | marshal.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1690,6 +1690,9 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod) v = r_object0(arg, &ivar, extmod); if (ivar) r_ivar(v, NULL, arg); + if (RB_TYPE_P(v, T_STRING)) { + v = r_leave(v, arg); + } } break; @@ -1819,7 +1822,9 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod) case TYPE_STRING: v = r_entry(r_string(arg), arg); - v = r_leave(v, arg); + if (!ivp) { + v = r_leave(v, arg); + } break; case TYPE_REGEXP: |