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:
parent
9e697d5bee
commit
b6b8366698
@ -3073,6 +3073,11 @@ static Int
|
|||||||
if (!Yap_ExpandPreAllocCodeSpace(0, NULL)) {
|
if (!Yap_ExpandPreAllocCodeSpace(0, NULL)) {
|
||||||
return FALSE;
|
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) {
|
} else if (Yap_Error_TYPE == OUT_OF_STACK_ERROR) {
|
||||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||||
if (!Yap_gc(nargs, ENV, CP)) {
|
if (!Yap_gc(nargs, ENV, CP)) {
|
||||||
@ -4142,7 +4147,7 @@ format(volatile Term otail, volatile Term oargs, int sno)
|
|||||||
if (IsIntegerTerm(t)) {
|
if (IsIntegerTerm(t)) {
|
||||||
Int il = IntegerOfTerm(t);
|
Int il = IntegerOfTerm(t);
|
||||||
#if HAVE_SNPRINTF
|
#if HAVE_SNPRINTF
|
||||||
snprintf(tmp1, 256, "%ld", il);
|
snprintf(tmp1, 256, "%ld", (long int)il);
|
||||||
#else
|
#else
|
||||||
sprintf(tmp1, "%ld", (long int)il);
|
sprintf(tmp1, "%ld", (long int)il);
|
||||||
#endif
|
#endif
|
||||||
|
@ -752,6 +752,7 @@ Yap_tokenizer(int inp_stream)
|
|||||||
/* huge atom or variable, we are in trouble */
|
/* huge atom or variable, we are in trouble */
|
||||||
Yap_ErrorMessage = "Code Space Overflow due to huge atom";
|
Yap_ErrorMessage = "Code Space Overflow due to huge atom";
|
||||||
Yap_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
|
Yap_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
|
||||||
|
Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage);
|
||||||
if (p)
|
if (p)
|
||||||
p->Tok = Ord(kind = eot_tok);
|
p->Tok = Ord(kind = eot_tok);
|
||||||
/* serious error now */
|
/* serious error now */
|
||||||
@ -764,6 +765,7 @@ Yap_tokenizer(int inp_stream)
|
|||||||
/* don't do this in iso */
|
/* don't do this in iso */
|
||||||
Atom ae = Yap_LookupAtom(TokImage);
|
Atom ae = Yap_LookupAtom(TokImage);
|
||||||
if (ae == NIL) {
|
if (ae == NIL) {
|
||||||
|
Yap_Error_TYPE = OUT_OF_HEAP_ERROR;
|
||||||
Yap_ErrorMessage = "Code Space Overflow";
|
Yap_ErrorMessage = "Code Space Overflow";
|
||||||
if (p)
|
if (p)
|
||||||
t->Tok = Ord(kind = eot_tok);
|
t->Tok = Ord(kind = eot_tok);
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
<h2>Yap-5.1.0:</h2>
|
<h2>Yap-5.1.0:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li> FIXED: handle heap overflow from huge atoms in
|
||||||
|
Yap_LookupAtom/scanner (Nuno Fonseca).</li>
|
||||||
<li> FIXED: bignum was using int where should be long int (Roberto Bagnara).</li>
|
<li> FIXED: bignum was using int where should be long int (Roberto Bagnara).</li>
|
||||||
<li> NEW: x86_64 should have registers, right? First cut at using them.</li>
|
<li> NEW: x86_64 should have registers, right? First cut at using them.</li>
|
||||||
<li> FIXED: call_n would break under 64 bits, an int problem.</li>
|
<li> FIXED: call_n would break under 64 bits, an int problem.</li>
|
||||||
|
Reference in New Issue
Block a user