summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-12-19 14:10:58 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-12-20 14:12:38 +0900
commit2e7e153a2af1456515d43b6381e38534b069b1c2 (patch)
treea7c1730d6b86170e9e80f2e9705ea824ed517829 /error.c
parent18ba89093a0b214cd89f1567c037c239f094496d (diff)
downloadruby-2e7e153a2af1456515d43b6381e38534b069b1c2.tar.gz
[Bug #19242] Prohibit circular causes to be loaded
Diffstat (limited to 'error.c')
-rw-r--r--error.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/error.c b/error.c
index bf3725bc47..4bdd04bbc8 100644
--- a/error.c
+++ b/error.c
@@ -2959,6 +2959,8 @@ ivar_copy_i(st_data_t key, st_data_t val, st_data_t exc)
return ST_CONTINUE;
}
+void rb_exc_check_circular_cause(VALUE exc);
+
static VALUE
exception_loader(VALUE exc, VALUE obj)
{
@@ -2973,6 +2975,8 @@ exception_loader(VALUE exc, VALUE obj)
rb_ivar_foreach(obj, ivar_copy_i, exc);
+ rb_exc_check_circular_cause(exc);
+
if (rb_attr_get(exc, id_bt) == rb_attr_get(exc, id_bt_locations)) {
rb_ivar_set(exc, id_bt_locations, Qnil);
}