pike.git / src / error.c

version» Context lines:

pike.git/src/error.c:12:   #include "builtin_functions.h"   #include "array.h"   #include "object.h"   #include "main.h"   #include "builtin_functions.h"   #include "backend.h"   #include "operators.h"   #include "module_support.h"   #include "threads.h"    - RCSID("$Id: error.c,v 1.37 1999/08/25 05:06:33 hubbe Exp $"); + RCSID("$Id: error.c,v 1.38 1999/10/06 15:25:46 grubba Exp $");      #undef ATTRIBUTE   #define ATTRIBUTE(X)      JMP_BUF *recoveries=0;      #ifdef PIKE_DEBUG   void check_recovery_context(void)   {    char foo;
pike.git/src/error.c:293:   {    char *s;    get_all_args("error->cast",args,"%s",&s);    if(!strncmp(s,"array",5))    {    pop_n_elems(args);    ref_push_string(GENERIC_ERROR_THIS->desc);    ref_push_array(GENERIC_ERROR_THIS->backtrace);    f_aggregate(2);    }else{ -  /* do an error here! */ +  SIMPLE_BAD_ARG_ERROR("error->cast", 1, "the value \"array\"");    }   }      void f_error_index(INT32 args)   {    int ind;    get_all_args("error->`[]",args,"%i",&ind);    -  pop_n_elems(args); -  +     switch(ind)    { -  case 0: ref_push_string(GENERIC_ERROR_THIS->desc); break; -  case 1: ref_push_array(GENERIC_ERROR_THIS->backtrace); break; +  case 0: +  pop_n_elems(args); +  ref_push_string(GENERIC_ERROR_THIS->desc); +  break; +  case 1: +  pop_n_elems(args); +  ref_push_array(GENERIC_ERROR_THIS->backtrace); +  break;    default: -  /* do an index out of range error here! */ -  ; +  index_error("error->`[]", sp-args, args, NULL, sp-args, +  "Index %d is out of range 0 - 1.\n", ind); +  break;    }   }         void f_error_describe(INT32 args)   {    pop_n_elems(args);    ref_push_object(fp->current_object);    APPLY_MASTER("describe_backtrace",1);   }
pike.git/src/error.c:370:    ATTRIBUTE((noreturn))   {    char buf[8192];    struct pike_string *desc;    struct array *backtrace;    int i;      #ifdef HAVE_VSNPRINTF    vsnprintf(buf, sizeof(buf)-1, fmt, foo);   #else /* !HAVE_VSNPRINTF */ +  /* Sentinel that will be overwritten on buffer overflow. */ +  buf[sizeof(buf)-1] = '\0'; +     VSPRINTF(buf, fmt, foo);    -  if((long)strlen(buf) >= (long)sizeof(buf)) +  if(buf[sizeof(buf)-1])    fatal("Buffer overflow in error()\n");   #endif /* HAVE_VSNPRINTF */    in_error=buf;       ERROR_STRUCT(generic,o)->desc=make_shared_string(buf);    f_backtrace(0);       if(func)    {    push_int(0);