fix bad handliong of position overflow.
This commit is contained in:
parent
e02ca2f520
commit
212758d25e
14
C/iopreds.c
14
C/iopreds.c
@ -4101,6 +4101,11 @@ static Int
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
Yap_Error_TYPE = YAP_NO_ERROR;
|
Yap_Error_TYPE = YAP_NO_ERROR;
|
||||||
|
tpos = StreamPosition(inp_stream);
|
||||||
|
if (!Yap_unify(tpos,ARG5)) {
|
||||||
|
/* do this early so that we do not have to protect it in case of stack expansion */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
CELL *old_H;
|
CELL *old_H;
|
||||||
UInt cpos = 0;
|
UInt cpos = 0;
|
||||||
@ -4195,8 +4200,7 @@ static Int
|
|||||||
} else {
|
} else {
|
||||||
Yap_clean_tokenizer(tokstart, Yap_VarTable, Yap_AnonVarTable);
|
Yap_clean_tokenizer(tokstart, Yap_VarTable, Yap_AnonVarTable);
|
||||||
|
|
||||||
return Yap_unify(tpos,ARG5) &&
|
return Yap_unify_constant(ARG2, MkAtomTerm (AtomEof))
|
||||||
Yap_unify_constant(ARG2, MkAtomTerm (AtomEof))
|
|
||||||
&& Yap_unify_constant(ARG4, TermNil);
|
&& Yap_unify_constant(ARG4, TermNil);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4258,8 +4262,7 @@ static Int
|
|||||||
t[0] = terr;
|
t[0] = terr;
|
||||||
t[1] = MkAtomTerm(Yap_LookupAtom(Yap_ErrorMessage));
|
t[1] = MkAtomTerm(Yap_LookupAtom(Yap_ErrorMessage));
|
||||||
Yap_clean_tokenizer(tokstart, Yap_VarTable, Yap_AnonVarTable);
|
Yap_clean_tokenizer(tokstart, Yap_VarTable, Yap_AnonVarTable);
|
||||||
return(Yap_unify(tpos,ARG5) &&
|
return Yap_unify(ARG6,Yap_MkApplTerm(Yap_MkFunctor(AtomError,2),2,t));
|
||||||
Yap_unify(ARG6,Yap_MkApplTerm(Yap_MkFunctor(AtomError,2),2,t)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -4271,7 +4274,7 @@ static Int
|
|||||||
#if EMACS
|
#if EMACS
|
||||||
first_char = tokstart->TokPos;
|
first_char = tokstart->TokPos;
|
||||||
#endif /* EMACS */
|
#endif /* EMACS */
|
||||||
if (!Yap_unify(t, ARG2) || !Yap_unify(tpos,ARG5))
|
if (!Yap_unify(t, ARG2))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (AtomOfTerm (Deref (ARG1)) == AtomTrue) {
|
if (AtomOfTerm (Deref (ARG1)) == AtomTrue) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
@ -4291,7 +4294,6 @@ static Int
|
|||||||
Yap_growstack_in_parser(&old_TR, &tokstart, &Yap_VarTable);
|
Yap_growstack_in_parser(&old_TR, &tokstart, &Yap_VarTable);
|
||||||
ScannerStack = (char *)TR;
|
ScannerStack = (char *)TR;
|
||||||
TR = old_TR;
|
TR = old_TR;
|
||||||
old_H = H;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Yap_clean_tokenizer(tokstart, Yap_VarTable, Yap_AnonVarTable);
|
Yap_clean_tokenizer(tokstart, Yap_VarTable, Yap_AnonVarTable);
|
||||||
|
Reference in New Issue
Block a user