From 1c3c0c630116ca1503b32f77e24f6301953f4b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Wed, 22 Oct 2014 16:22:38 +0100 Subject: [PATCH] fix sub_atom, by Paulo Moura. --- C/atomic.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/C/atomic.c b/C/atomic.c index 32c766fdc..61b2f9002 100644 --- a/C/atomic.c +++ b/C/atomic.c @@ -1831,6 +1831,10 @@ init_sub_atomic( int sub_atom USES_REGS ) return FALSE; } else { min = IntegerOfTerm(tbef); + if ((Int)min < 0) { + Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, tbef, "sub_string/5"); + return FALSE; + }; mask |= SUB_ATOM_HAS_MIN; bnds++; } @@ -1841,6 +1845,10 @@ init_sub_atomic( int sub_atom USES_REGS ) return FALSE; } else { len = IntegerOfTerm(tsize); + if ((Int)len < 0) { + Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, tsize, "sub_string/5"); + return FALSE; + }; mask |= SUB_ATOM_HAS_SIZE; bnds++; } @@ -1851,6 +1859,10 @@ init_sub_atomic( int sub_atom USES_REGS ) return FALSE; } else { after = IntegerOfTerm(tafter); + if ((Int)after < 0) { + Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, tafter, "sub_string/5"); + return FALSE; + }; mask |= SUB_ATOM_HAS_AFTER; bnds++; }