bad handling of overflow.

This commit is contained in:
Vitor Santos Costa 2011-03-19 23:21:37 +00:00
parent c184d5feaa
commit a1fbcf872b

View File

@ -2802,6 +2802,9 @@ static Int ground_complex_term(register CELL *pt0, register CELL *pt0_end USES_R
*pt0 = TermNil; *pt0 = TermNil;
#else #else
if (pt0 < pt0_end) { if (pt0 < pt0_end) {
if (to_visit+2 >= (struct cp_frame *)AuxSp) {
goto heap_overflow;
}
to_visit[0] = pt0; to_visit[0] = pt0;
to_visit[1] = pt0_end; to_visit[1] = pt0_end;
to_visit += 2; to_visit += 2;
@ -2910,10 +2913,12 @@ int Yap_IsGroundTerm(Term t)
} }
} }
if (out < 0) { if (out < 0) {
*H++ = t;
if (!Yap_ExpandPreAllocCodeSpace(0, NULL, TRUE)) { if (!Yap_ExpandPreAllocCodeSpace(0, NULL, TRUE)) {
Yap_Error(OUT_OF_AUXSPACE_ERROR, ARG1, "overflow in ground"); Yap_Error(OUT_OF_AUXSPACE_ERROR, ARG1, "overflow in ground");
return FALSE; return FALSE;
} }
t = *--H;
} }
} }
} }