1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

eval_error.c: fix off-by-one error for --backtrace-limit

https://bugs.ruby-lang.org/issues/17413
This commit is contained in:
Yusuke Endoh 2020-12-21 11:33:22 +09:00
parent ac78d90d5e
commit eee93bc933

View file

@ -253,9 +253,9 @@ print_backtrace(const VALUE eclass, const VALUE errat, const VALUE str, int reve
}
// skip for explicit limit
if (rb_backtrace_length_limit >= 0 && len > rb_backtrace_length_limit + 1) {
if (rb_backtrace_length_limit >= 0 && len > rb_backtrace_length_limit + 2) {
skip_start = rb_backtrace_length_limit + 1;
skip_len = len - rb_backtrace_length_limit;
skip_len = len - skip_start;
}
for (i = 1; i < len; i++) {