mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
backtrace.c (packed_backtrace): fix broken ciidx
- fix at higher level to remove redundancy - ciidx should always be smaller than ci stack length
This commit is contained in:
+3
-6
@@ -22,9 +22,6 @@ count_backtrace(mrb_state *mrb, ptrdiff_t ciidx)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
if (ciidx >= mrb->c->ciend - mrb->c->cibase)
|
||||
ciidx = 10; /* ciidx is broken... */
|
||||
|
||||
for (ptrdiff_t i=ciidx; i >= 0; i--) {
|
||||
mrb_callinfo *ci;
|
||||
const mrb_irep *irep = 0;
|
||||
@@ -61,9 +58,6 @@ each_backtrace(mrb_state *mrb, ptrdiff_t ciidx, each_backtrace_func func, void *
|
||||
{
|
||||
uint32_t n = 0;
|
||||
|
||||
if (ciidx >= mrb->c->ciend - mrb->c->cibase)
|
||||
ciidx = 10; /* ciidx is broken... */
|
||||
|
||||
for (ptrdiff_t i=ciidx; i >= 0; i--) {
|
||||
struct backtrace_location loc;
|
||||
mrb_callinfo *ci;
|
||||
@@ -135,6 +129,9 @@ packed_backtrace(mrb_state *mrb)
|
||||
int size;
|
||||
void *ptr;
|
||||
|
||||
if (ciidx >= mrb->c->ciend - mrb->c->cibase)
|
||||
ciidx = mrb->c->ciend - mrb->c->cibase; /* ciidx is broken... */
|
||||
|
||||
len = count_backtrace(mrb, ciidx);
|
||||
size = len * sizeof(struct backtrace_location);
|
||||
backtrace = mrb_data_object_alloc(mrb, NULL, NULL, &bt_type);
|
||||
|
||||
Reference in New Issue
Block a user