From: Francis De Brabandere <francisdb@gmail.com> --- dlls/vbscript/interp.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 4c0fbd84564..e1df0a03c47 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -1820,25 +1820,41 @@ static HRESULT interp_step_local(exec_ctx_t *ctx) v = get_local_var(ctx, ref); + if(V_VT(stack_top(ctx, 0)) == VT_EMPTY && V_VT(stack_top(ctx, 1)) == VT_EMPTY) { + WARN("For loop not initialized\n"); + clear_ei(&ctx->script->ei); + ctx->script->ei.scode = MAKE_VBSERROR(VBSE_FOR_LOOP_NOT_INITIALIZED); + map_vbs_exception(&ctx->script->ei); + stack_popn(ctx, 3); + instr_jmp(ctx, ctx->instr->arg1.uint); + return S_OK; + } + V_VT(&zero) = VT_I2; V_I2(&zero) = 0; hres = VarCmp(stack_top(ctx, 0), &zero, ctx->script->lcid, 0); if(FAILED(hres)) - return hres; + goto loop_not_initialized; gteq_zero = hres == VARCMP_GT || hres == VARCMP_EQ; hres = VarCmp(v, stack_top(ctx, 1), ctx->script->lcid, 0); if(FAILED(hres)) - return hres; + goto loop_not_initialized; if(hres == VARCMP_EQ || hres == (gteq_zero ? VARCMP_LT : VARCMP_GT)) { ctx->instr++; }else { - stack_popn(ctx, 2); + stack_popn(ctx, 3); instr_jmp(ctx, ctx->instr->arg1.uint); } return S_OK; + +loop_not_initialized: + WARN("For loop not initialized\n"); + stack_popn(ctx, 2); + instr_jmp(ctx, ctx->instr->arg1.uint); + return hres; } static HRESULT interp_newenum(exec_ctx_t *ctx) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10515