summaryrefslogtreecommitdiff
path: root/eval_error.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2020-12-21 11:33:22 +0900
committerYusuke Endoh <mame@ruby-lang.org>2020-12-21 11:40:48 +0900
commiteee93bc9330cb069abb679a0a0d48a49b10f6a4e (patch)
tree8af3027760698c0234971fe464c19b12cb828cac /eval_error.c
parentac78d90d5e90d414fed2c5ea61faaaa4c57e1815 (diff)
downloadruby-eee93bc9330cb069abb679a0a0d48a49b10f6a4e.tar.gz
eval_error.c: fix off-by-one error for --backtrace-limit
https://bugs.ruby-lang.org/issues/17413
Diffstat (limited to 'eval_error.c')
-rw-r--r--eval_error.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/eval_error.c b/eval_error.c
index 1e6579c8a0..841275eed0 100644
--- a/eval_error.c
+++ b/eval_error.c
@@ -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++) {