summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authorshirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-29 06:47:30 +0000
committershirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-29 06:47:30 +0000
commitb965781e8f7088aa19c941d21ffac0b48a4bb6ec (patch)
treec3e63b5d48867e898cb5a78540802940bdab0adc /transcode.c
parent4add701ad4f3acb3ba74c6c29010d9a8820a53c7 (diff)
transcode.c: add GC guard on raise
* transcode.c (econv_s_search_convpath): add GC guard to fix SEGV on raise. [Bug #15162] [ruby-core:89172] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/transcode.c b/transcode.c
index 375346a30d..5bcee00359 100644
--- a/transcode.c
+++ b/transcode.c
@@ -3155,8 +3155,12 @@ econv_s_search_convpath(int argc, VALUE *argv, VALUE klass)
convpath = Qnil;
transcode_search_path(sname, dname, search_convpath_i, &convpath);
- if (NIL_P(convpath))
- rb_exc_raise(rb_econv_open_exc(sname, dname, ecflags));
+ if (NIL_P(convpath)) {
+ VALUE exc = rb_econv_open_exc(sname, dname, ecflags);
+ RB_GC_GUARD(snamev);
+ RB_GC_GUARD(dnamev);
+ rb_exc_raise(exc);
+ }
if (decorate_convpath(convpath, ecflags) == -1) {
VALUE exc = rb_econv_open_exc(sname, dname, ecflags);