Huge atoms in scanner may generate heap overflow.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1532 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc
2006-02-01 13:58:30 +00:00
parent 9e697d5bee
commit b6b8366698
3 changed files with 10 additions and 1 deletions

View File

@@ -3073,6 +3073,11 @@ static Int
if (!Yap_ExpandPreAllocCodeSpace(0, NULL)) {
return FALSE;
}
} else if (Yap_Error_TYPE == OUT_OF_HEAP_ERROR) {
Yap_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growheap(FALSE, 0, NULL)) {
return FALSE;
}
} else if (Yap_Error_TYPE == OUT_OF_STACK_ERROR) {
Yap_Error_TYPE = YAP_NO_ERROR;
if (!Yap_gc(nargs, ENV, CP)) {
@@ -4142,7 +4147,7 @@ format(volatile Term otail, volatile Term oargs, int sno)
if (IsIntegerTerm(t)) {
Int il = IntegerOfTerm(t);
#if HAVE_SNPRINTF
snprintf(tmp1, 256, "%ld", il);
snprintf(tmp1, 256, "%ld", (long int)il);
#else
sprintf(tmp1, "%ld", (long int)il);
#endif