check for overflow in big strings
This commit is contained in:
parent
ba866a36e2
commit
610ca06883
@ -560,6 +560,10 @@ ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS)
|
||||
t = MkAtomTerm(Yap_LookupWideAtom(p));
|
||||
else
|
||||
t = Yap_WideStringToList(p);
|
||||
if (t == 0L) {
|
||||
LOCAL_ErrorMessage = "Stack Overflow";
|
||||
FAIL;
|
||||
}
|
||||
NextToken;
|
||||
}
|
||||
break;
|
||||
|
@ -836,14 +836,14 @@ ch_to_wide(char *base, char *charp)
|
||||
}
|
||||
|
||||
#define add_ch_to_buff(ch) \
|
||||
if (wcharp) { *wcharp++ = (ch); charp = (char *)wcharp; } \
|
||||
if (wcharp) { *wcharp++ = (ch); if (wcharp >= (wchar_t *)AuxSp-1024) goto huge_var_error; charp = (char *)wcharp; } \
|
||||
else { \
|
||||
if (ch > MAX_ISO_LATIN1 && !wcharp) { \
|
||||
/* does not fit in ISO-LATIN */ \
|
||||
wcharp = ch_to_wide(TokImage, charp); \
|
||||
if (!wcharp) goto huge_var_error; \
|
||||
*wcharp++ = (ch); charp = (char *)wcharp; \
|
||||
} else *charp++ = ch; \
|
||||
} else { if (charp >= (char *)AuxSp-1024) goto huge_var_error; *charp++ = ch; } \
|
||||
}
|
||||
|
||||
TokEntry *
|
||||
|
Reference in New Issue
Block a user