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

Alexandre Julliard julliard at winehq.org
Mon May 1 16:38:05 CDT 2017


Module: wine
Branch: master
Commit: 8bd99c363a385ed0191987a7c069b0fe99bc374a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8bd99c363a385ed0191987a7c069b0fe99bc374a

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon May  1 18:30:18 2017 +0200

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

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/compile.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index 662326b..6a818ac 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -1387,18 +1387,25 @@ static HRESULT pop_to_stat(compiler_ctx_t *ctx, statement_ctx_t *stat_ctx)
 {
     unsigned stack_pop = 0;
     statement_ctx_t *iter;
+    HRESULT hres;
 
     for(iter = ctx->stat_ctx; iter != stat_ctx; iter = iter->next) {
         if(iter->using_scope && !push_instr(ctx, OP_pop_scope))
             return E_OUTOFMEMORY;
-        if(iter->using_except && !push_instr(ctx, OP_pop_except))
-            return E_OUTOFMEMORY;
+        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;
+        }
         stack_pop += iter->stack_use;
     }
 
     if(stack_pop) {
-        HRESULT hres;
-
         hres = push_instr_uint(ctx, OP_pop, stack_pop);
         if(FAILED(hres))
             return hres;




More information about the wine-cvs mailing list