check for overflows while building large constants (atom_chars and
friends). git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@648 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
5fd92de03b
commit
593162243d
21
C/stdpreds.c
21
C/stdpreds.c
@ -519,6 +519,9 @@ p_name(void)
|
||||
Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO,Head,"name/2");
|
||||
return(FALSE);
|
||||
}
|
||||
if (Unsigned(TrailTop) - Unsigned(s) < MinTrailGap) {
|
||||
growtrail(sizeof(CELL) * 16 * 1024L);
|
||||
}
|
||||
*s++ = i;
|
||||
t = TailOfTerm(t);
|
||||
}
|
||||
@ -588,6 +591,9 @@ p_atom_chars(void)
|
||||
Error(REPRESENTATION_ERROR_CHARACTER_CODE,Head,"atom_chars/2");
|
||||
return(FALSE);
|
||||
}
|
||||
if (Unsigned(TrailTop) - Unsigned(s) < MinTrailGap) {
|
||||
growtrail(sizeof(CELL) * 16 * 1024L);
|
||||
}
|
||||
*s++ = i;
|
||||
t = TailOfTerm(t);
|
||||
if (IsVarTerm(t)) {
|
||||
@ -617,6 +623,9 @@ p_atom_chars(void)
|
||||
Error(TYPE_ERROR_CHARACTER,Head,"atom_chars/2");
|
||||
return(FALSE);
|
||||
}
|
||||
if (Unsigned(TrailTop) - Unsigned(s) < MinTrailGap) {
|
||||
growtrail(sizeof(CELL) * 16 * 1024L);
|
||||
}
|
||||
*s++ = is[0];
|
||||
t = TailOfTerm(t);
|
||||
if (IsVarTerm(t)) {
|
||||
@ -739,6 +748,9 @@ p_atom_codes(void)
|
||||
Error(REPRESENTATION_ERROR_CHARACTER_CODE,Head,"atom_codes/2");
|
||||
return(FALSE);
|
||||
}
|
||||
if (Unsigned(TrailTop) - Unsigned(s) < MinTrailGap) {
|
||||
growtrail(sizeof(CELL) * 16 * 1024L);
|
||||
}
|
||||
*s++ = i;
|
||||
t = TailOfTerm(t);
|
||||
if (IsVarTerm(t)) {
|
||||
@ -926,6 +938,9 @@ p_number_chars(void)
|
||||
Error(REPRESENTATION_ERROR_CHARACTER_CODE,Head,"number_chars/2");
|
||||
return(FALSE);
|
||||
}
|
||||
if (Unsigned(TrailTop) - Unsigned(s) < MinTrailGap) {
|
||||
growtrail(sizeof(CELL) * 16 * 1024L);
|
||||
}
|
||||
*s++ = i;
|
||||
t = TailOfTerm(t);
|
||||
if (IsVarTerm(t)) {
|
||||
@ -955,6 +970,9 @@ p_number_chars(void)
|
||||
Error(TYPE_ERROR_CHARACTER,Head,"number_chars/2");
|
||||
return(FALSE);
|
||||
}
|
||||
if (Unsigned(TrailTop) - Unsigned(s) < MinTrailGap) {
|
||||
growtrail(sizeof(CELL) * 16 * 1024L);
|
||||
}
|
||||
*s++ = is[0];
|
||||
t = TailOfTerm(t);
|
||||
if (IsVarTerm(t)) {
|
||||
@ -1098,6 +1116,9 @@ p_number_codes(void)
|
||||
Error(REPRESENTATION_ERROR_CHARACTER_CODE,Head,"number_codes/2");
|
||||
return(FALSE);
|
||||
}
|
||||
if (Unsigned(TrailTop) - Unsigned(s) < MinTrailGap) {
|
||||
growtrail(sizeof(CELL) * 16 * 1024L);
|
||||
}
|
||||
*s++ = i;
|
||||
t = TailOfTerm(t);
|
||||
if (IsVarTerm(t)) {
|
||||
|
Reference in New Issue
Block a user