Skip to content

Commit

Permalink
The original code crashed when mrb->backtrace.n grew to 16.
Browse files Browse the repository at this point in the history
It looks like the logic to reallocate the backtrace was flawed,
based on the wrong variable (loc_raw->i, which, as I have verified,
decreases from 16 to 0 instead of increasing)

I am not sure if this is the correct fix
  • Loading branch information
Carlo Prelz committed Feb 26, 2016
1 parent 0c23d5a commit d6cbe1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ save_backtrace_i(mrb_state *mrb,
{
mrb_backtrace_entry *entry;

if (loc_raw->i >= mrb->backtrace.n_allocated) {
if (mrb->backtrace.n >= mrb->backtrace.n_allocated) {
int new_n_allocated;
if (mrb->backtrace.n_allocated == 0) {
new_n_allocated = 8;
Expand Down

0 comments on commit d6cbe1b

Please sign in to comment.