more fixes to error checking in error access.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@454 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-04-23 23:23:45 +00:00
parent 2d5fc60330
commit 376d26f93f
2 changed files with 7 additions and 4 deletions

View File

@ -158,8 +158,11 @@ AccessNamedArray(Atom a, Int indx)
if (ArrayIsDynamic(pp)) {
Term out;
READ_LOCK(pp->ArRWLock);
if (IsVarTerm(pp->ValueOfVE)) {
if (IsVarTerm(pp->ValueOfVE) ||
pp->ArrayEArity <= indx ||
indx < 0) {
READ_UNLOCK(pp->ArRWLock);
P = (yamop *)FAILCODE;
return(MkAtomTerm(AtomFoundVar));
}
out = RepAppl(pp->ValueOfVE)[indx+1];
@ -173,7 +176,7 @@ AccessNamedArray(Atom a, Int indx)
/* Error(DOMAIN_ERROR_ARRAY_OVERFLOW, MkIntegerTerm(indx), "access_array");*/
READ_UNLOCK(ptr->ArRWLock);
P = (yamop *)FAILCODE;
return(TermNil);
return(MkAtomTerm(AtomFoundVar));
}
switch (ptr->ArrayType) {
@ -302,7 +305,7 @@ p_access_array(void)
if (IsNonVarTerm(t)) {
if (IsApplTerm(t)) {
if (indx >= ArityOfFunctor(FunctorOfTerm(t))) {
if (indx >= ArityOfFunctor(FunctorOfTerm(t)) || indx < 0) {
/* Error(DOMAIN_ERROR_ARRAY_OVERFLOW, MkIntegerTerm(indx), "access_array");*/
P = (yamop *)FAILCODE;
return(FALSE);

View File

@ -112,7 +112,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
/* extern int gc_calls; */
vsc_count++;
if (vsc_count < 3829100) return;
/* if (vsc_count < 3829100) return;*/
/*
if (vsc_count == 4376) {
printf("Here I go\n");