diff --git a/Tables/tables.c b/Tables/tables.c index f785036..3de4918 100644 --- a/Tables/tables.c +++ b/Tables/tables.c @@ -6,6 +6,8 @@ #define TAILLE_MEMOIRE (64) #define TAILLE_PILE_APPELS (16) +#define SECURISED (1) + /**************************************************/ /**************************************************/ @@ -199,10 +201,17 @@ void execute() { eip = programme[eip].param1 - 1; } else if (programme[eip].instruction == RET) { - esp--; - eip = pile[check_adresse_pile(esp)] - 1; - esp--; - ebp = pile[check_adresse_pile(esp)]; + if (SECURISED) { + esp--; + eip = pile[check_adresse_pile(esp)] - 1; + esp--; + ebp = pile[check_adresse_pile(esp)]; + } else { + int lastebp = ebp; + eip = mem[check_adresse(ebp - 1)] - 1; + ebp = mem[check_adresse(ebp - 2)]; + mem[check_adresse(lastebp - 2)] = mem[check_adresse(lastebp)]; + } } else if (programme[eip].instruction == STOP) { if (programme[eip].param1 == 0) {