pike.git / src / opcodes.c

version» Context lines:

pike.git/src/opcodes.c:16:   #include "object.h"   #include "error.h"   #include "pike_types.h"   #include "pike_memory.h"   #include "fd_control.h"   #include "cyclic.h"   #include "builtin_functions.h"   #include "module_support.h"   #include "security.h"    - RCSID("$Id: opcodes.c,v 1.42 1999/07/27 16:41:37 mirar Exp $"); + RCSID("$Id: opcodes.c,v 1.43 1999/08/21 23:21:07 noring Exp $");      void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)   {    INT32 i;      #ifdef PIKE_SECURITY    if(what->type <= MAX_COMPLEX)    if(!CHECK_DATA_SECURITY(what->u.array, SECURITY_BIT_INDEX))    error("Index permission denied.\n");   #endif
pike.git/src/opcodes.c:56:    to->u.integer=i;    break;       case T_STRING:    if(ind->type==T_INT)    {    i=ind->u.integer;    if(i<0)    i+=what->u.string->len;    if(i<0 || i>=what->u.string->len) -  error("Index %d is out of range 0 - %d.\n", i, what->u.string->len-1); +  { +  if(what->u.string->len == 0) +  error("Attempt to index the empty string with %d.\n", i);    else -  +  error("Index %d is out of string range 0 - %d.\n", +  i, what->u.string->len-1); +  } else    i=index_shared_string(what->u.string,i);    to->type=T_INT;    to->subtype=NUMBER_NUMBER;    to->u.integer=i;    break;    }else{    error("Index is not an integer.\n");    }       case T_PROGRAM: