__wine_dbg_output accumulates the output characters in a debug_info structure, flushing it when it encounters '\n'. If debug_info plus the new string exceed 1024 characters, append_output will print
wine_dbg_output: debugstr buffer overflow
and then crash the process via abort().
wine_dbgstr_variant limits the length printed for any individual argument, but a function with multiple parameters can still plausibly exceed 1024.
Fixed by formatting the TRACE for each argument on a separate line, as similar places (like oleaut32/typelib.c:dump_DispParms) do.
From: Kevin Puetz PuetzKevinA@JohnDeere.com
__wine_dbg_output accumulates the output characters in a debug_info structure, flushing it when it encounters '\n'. If debug_info plus the new string exceed 1024 characters, append_output will print
wine_dbg_output: debugstr buffer overflow
and then crash the process via abort().
wine_dbgstr_variant limits the length printed for any individual argument, but a function with multiple parameters can still plausibly exceed 1024.
Fixed by formatting the TRACE for each argument on a separate line, as similar places (like oleaut32/typelib.c:dump_DispParms) do. --- dlls/vbscript/interp.c | 5 ++--- dlls/vbscript/tests/api.vbs | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/vbscript/interp.c b/dlls/vbscript/interp.c index 2d40e6efe47..fd5ef3eddb8 100644 --- a/dlls/vbscript/interp.c +++ b/dlls/vbscript/interp.c @@ -2422,7 +2422,7 @@ HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbd
heap_pool_init(&exec.heap);
- TRACE("%s(", debugstr_w(func->name)); + TRACE("%s args=%u\n", debugstr_w(func->name),func->arg_cnt); if(func->arg_cnt) { VARIANT *v; unsigned i; @@ -2435,7 +2435,7 @@ HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbd
for(i=0; i < func->arg_cnt; i++) { v = get_arg(dp, i); - TRACE("%s%s", i ? ", " : "", debugstr_variant(v)); + TRACE(" [%d] %s\n", i, debugstr_variant(v)); if(V_VT(v) == (VT_VARIANT|VT_BYREF)) { if(func->args[i].by_ref) exec.args[i] = *v; @@ -2452,7 +2452,6 @@ HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbd }else { exec.args = NULL; } - TRACE(")\n");
if(func->var_cnt) { exec.vars = heap_alloc_zero(func->var_cnt * sizeof(VARIANT)); diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs index b9c2149aa56..000ae1b5167 100644 --- a/dlls/vbscript/tests/api.vbs +++ b/dlls/vbscript/tests/api.vbs @@ -777,6 +777,11 @@ sub testSpaceError() end sub call testSpaceError()
+function strlength(s1, s2, s3, s4, s5) + strlength = Len(s1 & s2 & s3 & s4 & s5) +end function +Call ok(strlength(String(500, "a"), String(500, "b"), String(500, "c"), String(500, "d"), String(500, "e")) = 500*5, "strlength(...) = 500*5") + sub test_string(cnt, char, exp) call ok(String(cnt, char) = exp, "String(" & cnt & ", """ & char & """ = """ & _ String(cnt, char) & """ expected """ & exp & """")
This merge request was approved by Jacek Caban.