From 2c769767a496584e7053c7fbd14e2e583e015eb1 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Thu, 8 Aug 2013 14:11:45 -0500 Subject: [PATCH] fix bug in sub_atom when substring is largwer than string --- C/atoms.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/C/atoms.c b/C/atoms.c index 0362d1b06..2a85a53cc 100644 --- a/C/atoms.c +++ b/C/atoms.c @@ -2313,6 +2313,8 @@ init_sub_atom( USES_REGS1 ) Yap_unify(ARG1, ARG5) && Yap_unify(ARG2, MkIntegerTerm(0)) && Yap_unify(ARG4, MkIntegerTerm(0)); + } else if (len > sz) { + cut_fail(); } else { mask |= SUB_ATOM_HAS_SIZE; min = 0;