Commit 8bd99c36 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Ensure that OP_pop_except is called with proper stack depth.

parent 622eb728
...@@ -1387,18 +1387,25 @@ static HRESULT pop_to_stat(compiler_ctx_t *ctx, statement_ctx_t *stat_ctx) ...@@ -1387,18 +1387,25 @@ static HRESULT pop_to_stat(compiler_ctx_t *ctx, statement_ctx_t *stat_ctx)
{ {
unsigned stack_pop = 0; unsigned stack_pop = 0;
statement_ctx_t *iter; statement_ctx_t *iter;
HRESULT hres;
for(iter = ctx->stat_ctx; iter != stat_ctx; iter = iter->next) { for(iter = ctx->stat_ctx; iter != stat_ctx; iter = iter->next) {
if(iter->using_scope && !push_instr(ctx, OP_pop_scope)) if(iter->using_scope && !push_instr(ctx, OP_pop_scope))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if(iter->using_except && !push_instr(ctx, OP_pop_except)) if(iter->using_except) {
if(stack_pop) {
hres = push_instr_uint(ctx, OP_pop, stack_pop);
if(FAILED(hres))
return hres;
stack_pop = 0;
}
if(!push_instr(ctx, OP_pop_except))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
}
stack_pop += iter->stack_use; stack_pop += iter->stack_use;
} }
if(stack_pop) { if(stack_pop) {
HRESULT hres;
hres = push_instr_uint(ctx, OP_pop, stack_pop); hres = push_instr_uint(ctx, OP_pop, stack_pop);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment