Don't abort on big input

This commit is contained in:
zimoch
2007-11-30 15:24:38 +00:00
parent ed8b3aded1
commit 55c8977e7b

View File

@ -60,7 +60,8 @@ grow(long minsize)
// make space for minsize + 1 (for termination) bytes // make space for minsize + 1 (for termination) bytes
char* newbuffer; char* newbuffer;
long newcap; long newcap;
if (minsize > 10000) #ifdef EXPLODE
if (minsize > 1000000)
{ {
// crude trap against infinite grow // crude trap against infinite grow
error ("StreamBuffer exploded growing from %ld to %ld chars. Exiting\n", error ("StreamBuffer exploded growing from %ld to %ld chars. Exiting\n",
@ -83,6 +84,7 @@ grow(long minsize)
fprintf(stderr, "\n"); fprintf(stderr, "\n");
abort(); abort();
} }
#endif
if (minsize < cap) if (minsize < cap)
{ {
// just move contents to start of buffer and clear end // just move contents to start of buffer and clear end