1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

Fix bug that causes gawk to choke when parsing long source files.

Reported by:	Tony Fleisher <takhus@takhus.mind.net>
Submitted by:	Aharon Robbins <arnold@skeeve.com>
This commit is contained in:
Sheldon Hearn 2000-09-04 10:42:19 +00:00
parent 5f435a0876
commit c3f4a67494
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=65435
2 changed files with 11 additions and 5 deletions

View File

@ -2104,9 +2104,11 @@ size_t len;
retval = (retval * 16) + val;
}
} else if (*str == '0') {
if (strchr(str, '8') != NULL || strchr(str, '9') != NULL)
goto decimal;
for (; len > 0; len--) {
if (! isdigit(*str) || *str == '8' || *str == '9')
goto decimal;
if (! isdigit(*str))
goto done;
retval = (retval * 8) + (*str - '0');
str++;
}

View File

@ -264,9 +264,13 @@ int freeold;
emalloc(databuf, char *, INITIAL_SIZE, "set_record");
databuf_size = INITIAL_SIZE;
}
/* make sure there's enough room */
if (cnt > databuf_size) {
while (cnt > databuf_size && databuf_size <= MAX_SIZE)
/*
* Make sure there's enough room. Since we sometimes need
* to place a sentinel at the end, we make sure
* databuf_size is > cnt after allocation.
*/
if (cnt >= databuf_size) {
while (cnt >= databuf_size && databuf_size <= MAX_SIZE)
databuf_size *= 2;
erealloc(databuf, char *, databuf_size, "set_record");
}