mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[Bug #19242] Prohibit circular causes to be loaded
This commit is contained in:
parent
18ba89093a
commit
2e7e153a2a
Notes:
git
2022-12-20 05:13:10 +00:00
4 changed files with 31 additions and 0 deletions
4
eval.c
4
eval.c
|
@ -537,12 +537,16 @@ exc_setup_message(const rb_execution_context_t *ec, VALUE mesg, VALUE *cause)
|
|||
}
|
||||
|
||||
if (!nocircular && !NIL_P(*cause) && !UNDEF_P(*cause) && *cause != mesg) {
|
||||
#if 0 /* maybe critical for some cases */
|
||||
rb_exc_check_circular_cause(*cause);
|
||||
#else
|
||||
VALUE c = *cause;
|
||||
while (!NIL_P(c = rb_attr_get(c, id_cause))) {
|
||||
if (c == mesg) {
|
||||
rb_raise(rb_eArgError, "circular causes");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return mesg;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue