From 4639402912e79196aec1752ea854c7bd48e3acdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Wed, 4 Oct 2000 15:59:11 -0700 Subject: [PATCH] fixed a core dumping bug Rev: src/builtin_functions.c:1.314 --- src/builtin_functions.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/builtin_functions.c b/src/builtin_functions.c index 487cd85521..03779a73f5 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: builtin_functions.c,v 1.313 2000/09/30 13:42:41 grubba Exp $"); +RCSID("$Id: builtin_functions.c,v 1.314 2000/10/04 22:59:11 hubbe Exp $"); #include "interpret.h" #include "svalue.h" #include "pike_macros.h" @@ -701,15 +701,21 @@ PMOD_EXPORT void f_backtrace(INT32 args) if(f->current_object && f->context.prog) { INT32 args; - args=f->num_args; - args = DO_NOT_WARN((INT32) MINIMUM(f->num_args, Pike_sp - f->locals)); - if(of) - args = DO_NOT_WARN((INT32)MINIMUM(f->num_args,of->locals - f->locals)); - args=MAXIMUM(args,0); + if(!f->locals) + { + args=0; + }else{ + args=f->num_args; + args = DO_NOT_WARN((INT32) MINIMUM(f->num_args, Pike_sp - f->locals)); + if(of) + args = DO_NOT_WARN((INT32)MINIMUM(f->num_args,of->locals - f->locals)); + args=MAXIMUM(args,0); + } ITEM(a)[frames].u.array=i=allocate_array_no_init(3+args,0); ITEM(a)[frames].type=T_ARRAY; - assign_svalues_no_free(ITEM(i)+3, f->locals, args, BIT_MIXED); + if(f->locals) + assign_svalues_no_free(ITEM(i)+3, f->locals, args, BIT_MIXED); if(f->current_object->prog) { ITEM(i)[2].type=T_FUNCTION; -- GitLab