fix a few extra overflows.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1993 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
5ff3890130
commit
01432a467a
2
C/grow.c
2
C/grow.c
@ -1518,7 +1518,7 @@ Yap_growtrail_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep)
|
|||||||
CELL **
|
CELL **
|
||||||
Yap_shift_visit(CELL **to_visit, CELL ***to_visit_maxp)
|
Yap_shift_visit(CELL **to_visit, CELL ***to_visit_maxp)
|
||||||
{
|
{
|
||||||
#if USE_SYSTEM_MALLOC || USE_DL_MALLOC
|
#if USE_SYSTEM_MALLOC
|
||||||
CELL **to_visit_max = *to_visit_maxp;
|
CELL **to_visit_max = *to_visit_maxp;
|
||||||
Int sz1 = (CELL)to_visit_max-(CELL)to_visit;
|
Int sz1 = (CELL)to_visit_max-(CELL)to_visit;
|
||||||
Int sz0 = AuxTop - (ADDR)to_visit_maxp, sz, dsz;
|
Int sz0 = AuxTop - (ADDR)to_visit_maxp, sz, dsz;
|
||||||
|
@ -521,6 +521,9 @@ static Term vars_in_complex_term(register CELL *pt0, register CELL *pt0_end, Ter
|
|||||||
vars_in_term_nvar:
|
vars_in_term_nvar:
|
||||||
{
|
{
|
||||||
if (IsPairTerm(d0)) {
|
if (IsPairTerm(d0)) {
|
||||||
|
if (to_visit + 1024 >= (CELL **)AuxSp) {
|
||||||
|
goto aux_overflow;
|
||||||
|
}
|
||||||
#ifdef RATIONAL_TREES
|
#ifdef RATIONAL_TREES
|
||||||
to_visit[0] = pt0;
|
to_visit[0] = pt0;
|
||||||
to_visit[1] = pt0_end;
|
to_visit[1] = pt0_end;
|
||||||
@ -547,6 +550,9 @@ static Term vars_in_complex_term(register CELL *pt0, register CELL *pt0_end, Ter
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* store the terms to visit */
|
/* store the terms to visit */
|
||||||
|
if (to_visit + 1024 >= (CELL **)AuxSp) {
|
||||||
|
goto aux_overflow;
|
||||||
|
}
|
||||||
#ifdef RATIONAL_TREES
|
#ifdef RATIONAL_TREES
|
||||||
to_visit[0] = pt0;
|
to_visit[0] = pt0;
|
||||||
to_visit[1] = pt0_end;
|
to_visit[1] = pt0_end;
|
||||||
@ -633,6 +639,21 @@ static Term vars_in_complex_term(register CELL *pt0, register CELL *pt0_end, Ter
|
|||||||
H = InitialH;
|
H = InitialH;
|
||||||
return 0L;
|
return 0L;
|
||||||
|
|
||||||
|
aux_overflow:
|
||||||
|
Yap_Error_Size = (to_visit-to_visit0)*sizeof(CELL **);
|
||||||
|
#ifdef RATIONAL_TREES
|
||||||
|
while (to_visit > to_visit0) {
|
||||||
|
to_visit -= 3;
|
||||||
|
pt0 = to_visit[0];
|
||||||
|
*pt0 = (CELL)to_visit[2];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Yap_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
|
||||||
|
clean_tr(TR0);
|
||||||
|
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
|
||||||
|
H = InitialH;
|
||||||
|
return 0L;
|
||||||
|
|
||||||
global_overflow:
|
global_overflow:
|
||||||
#ifdef RATIONAL_TREES
|
#ifdef RATIONAL_TREES
|
||||||
while (to_visit > to_visit0) {
|
while (to_visit > to_visit0) {
|
||||||
@ -663,6 +684,13 @@ expand_vts(void)
|
|||||||
if (!Yap_growtrail(expand, FALSE)) {
|
if (!Yap_growtrail(expand, FALSE)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
} else if (yap_errno == OUT_OF_AUXSPACE_ERROR) {
|
||||||
|
/* Aux space overflow */
|
||||||
|
if (expand > 4*1024*1024)
|
||||||
|
expand = 4*1024*1024;
|
||||||
|
if (!Yap_ExpandPreAllocCodeSpace(expand, NULL)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!Yap_gcl(expand, 3, ENV, P)) {
|
if (!Yap_gcl(expand, 3, ENV, P)) {
|
||||||
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "in term_variables");
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "in term_variables");
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
|
|
||||||
<h2>Yap-5.1.3:</h2>
|
<h2>Yap-5.1.3:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li> FIXED: Yap_shift_visit assumed we were using AUX DL_MALLOC (obs
|
||||||
|
from Bernd Gutmann).</li>
|
||||||
|
<li> FIXED: auxiliary stack overflow in term_vars (obs from Bernd
|
||||||
|
Gutmann).</li>
|
||||||
<li> FIXED: trail overflow while copying huge terms (obs from Bernd
|
<li> FIXED: trail overflow while copying huge terms (obs from Bernd
|
||||||
Gutmann).</li>
|
Gutmann).</li>
|
||||||
<li> NEW: compilation_mode option for load_files (request from
|
<li> NEW: compilation_mode option for load_files (request from
|
||||||
|
Reference in New Issue
Block a user