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:
parent
2d5fc60330
commit
376d26f93f
@ -158,8 +158,11 @@ AccessNamedArray(Atom a, Int indx)
|
|||||||
if (ArrayIsDynamic(pp)) {
|
if (ArrayIsDynamic(pp)) {
|
||||||
Term out;
|
Term out;
|
||||||
READ_LOCK(pp->ArRWLock);
|
READ_LOCK(pp->ArRWLock);
|
||||||
if (IsVarTerm(pp->ValueOfVE)) {
|
if (IsVarTerm(pp->ValueOfVE) ||
|
||||||
|
pp->ArrayEArity <= indx ||
|
||||||
|
indx < 0) {
|
||||||
READ_UNLOCK(pp->ArRWLock);
|
READ_UNLOCK(pp->ArRWLock);
|
||||||
|
P = (yamop *)FAILCODE;
|
||||||
return(MkAtomTerm(AtomFoundVar));
|
return(MkAtomTerm(AtomFoundVar));
|
||||||
}
|
}
|
||||||
out = RepAppl(pp->ValueOfVE)[indx+1];
|
out = RepAppl(pp->ValueOfVE)[indx+1];
|
||||||
@ -173,7 +176,7 @@ AccessNamedArray(Atom a, Int indx)
|
|||||||
/* Error(DOMAIN_ERROR_ARRAY_OVERFLOW, MkIntegerTerm(indx), "access_array");*/
|
/* Error(DOMAIN_ERROR_ARRAY_OVERFLOW, MkIntegerTerm(indx), "access_array");*/
|
||||||
READ_UNLOCK(ptr->ArRWLock);
|
READ_UNLOCK(ptr->ArRWLock);
|
||||||
P = (yamop *)FAILCODE;
|
P = (yamop *)FAILCODE;
|
||||||
return(TermNil);
|
return(MkAtomTerm(AtomFoundVar));
|
||||||
}
|
}
|
||||||
switch (ptr->ArrayType) {
|
switch (ptr->ArrayType) {
|
||||||
|
|
||||||
@ -302,7 +305,7 @@ p_access_array(void)
|
|||||||
|
|
||||||
if (IsNonVarTerm(t)) {
|
if (IsNonVarTerm(t)) {
|
||||||
if (IsApplTerm(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");*/
|
/* Error(DOMAIN_ERROR_ARRAY_OVERFLOW, MkIntegerTerm(indx), "access_array");*/
|
||||||
P = (yamop *)FAILCODE;
|
P = (yamop *)FAILCODE;
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
@ -112,7 +112,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
|
|||||||
/* extern int gc_calls; */
|
/* extern int gc_calls; */
|
||||||
|
|
||||||
vsc_count++;
|
vsc_count++;
|
||||||
if (vsc_count < 3829100) return;
|
/* if (vsc_count < 3829100) return;*/
|
||||||
/*
|
/*
|
||||||
if (vsc_count == 4376) {
|
if (vsc_count == 4376) {
|
||||||
printf("Here I go\n");
|
printf("Here I go\n");
|
||||||
|
Reference in New Issue
Block a user