Skip to content

Commit

Permalink
DIRECTOR: Lingo: Fix stack underflow on not enough parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Aug 3, 2016
1 parent dc49888 commit fa7725a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 12 additions & 6 deletions engines/director/lingo/lingo-code.cpp
Expand Up @@ -55,6 +55,13 @@ void Lingo::push(Datum d) {
_stack.push_back(d);
}

void Lingo::pushVoid() {
Datum d;
d.u.i = 0;
d.type = VOID;
push(d);
}

Datum Lingo::pop(void) {
if (_stack.size() == 0)
error("stack underflow");
Expand Down Expand Up @@ -692,10 +699,7 @@ void Lingo::c_call() {
g_lingo->pop();

// Push dummy value
Datum d;
d.u.i = 0;
d.type = VOID;
g_lingo->push(d);
g_lingo->pushVoid();

return;
}
Expand All @@ -714,8 +718,10 @@ void Lingo::c_call() {
for (int i = 0; i < nargs; i++)
g_lingo->pop();

return;
}
g_lingo->pushVoid();

return;
}
(*sym->u.func)();

return;
Expand Down
2 changes: 2 additions & 0 deletions engines/director/lingo/lingo.h
Expand Up @@ -189,6 +189,8 @@ class Lingo {
int codeFloat(double f);
void codeFactory(Common::String &s);

void pushVoid();

static void c_xpop();
static void c_printtop();

Expand Down

0 comments on commit fa7725a

Please sign in to comment.