From 68d913d181a4bba5f585016fb393ea5c000bb717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Thu, 1 Apr 1999 09:20:17 -0800 Subject: [PATCH] more debug Rev: src/stralloc.c:1.58 --- src/stralloc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/stralloc.c b/src/stralloc.c index 8fc1990424..ef6af50733 100644 --- a/src/stralloc.c +++ b/src/stralloc.c @@ -23,7 +23,7 @@ #define HUGE HUGE_VAL #endif /*!HUGE*/ -RCSID("$Id: stralloc.c,v 1.57 1999/03/23 03:04:00 marcus Exp $"); +RCSID("$Id: stralloc.c,v 1.58 1999/04/01 17:20:17 hubbe Exp $"); #define BEGIN_HASH_SIZE 997 #define MAX_AVG_LINK_LENGTH 3 @@ -175,6 +175,11 @@ void generic_memcpy(PCHARP to, PCHARP from, int len) { +#ifdef PIKE_DEBUG + if(len<0) + fatal("Cannot copy %d bytes!\n",len); +#endif + switch(TWO_SIZES(from.shift,to.shift)) { case TWO_SIZES(0,0): @@ -1374,6 +1379,10 @@ struct pike_string *string_replace(struct pike_string *str, (end-s)>>str->size_shift, str->size_shift))) { +#ifdef PIKE_DEBUG + if(tmp + (del->len << str->size_shift) > end) + fatal("generic_memory_search found a match beyond end of string!!!\n"); +#endif generic_memcpy(r,MKPCHARP(s,str->size_shift),(tmp-s)>>str->size_shift); INC_PCHARP(r,(tmp-s)>>str->size_shift); pike_string_cpy(r,to); -- GitLab