[PATCH] riched20: Return E_INVALIDARG from ITextServices::TxGetText on null output.

Huw Davies huw at codeweavers.com
Thu Apr 26 05:11:16 CDT 2018


On Wed, Apr 25, 2018 at 04:33:55PM +0800, Jactry Zeng wrote:
> Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
> ---
>  dlls/riched20/tests/txtsrv.c | 3 +++
>  dlls/riched20/txtsrv.c       | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c
> index 73ca7cd753..5f261889f7 100644
> --- a/dlls/riched20/tests/txtsrv.c
> +++ b/dlls/riched20/tests/txtsrv.c
> @@ -652,6 +652,9 @@ static void test_TxGetText(void)
>      if (!init_texthost(&txtserv, &host))
>          return;
>  
> +    hres = ITextServices_TxGetText(txtserv, NULL);
> +    ok(hres == E_INVALIDARG, "ITextServices_TxGetText should fail (result = %x)\n", hres);
> +
>      hres = ITextServices_TxGetText(txtserv, &rettext);
>      ok(hres == S_OK, "ITextServices_TxGetText failed (result = %x)\n", hres);
>  
> diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c
> index eb61e4eff6..8e9737e4a1 100644
> --- a/dlls/riched20/txtsrv.c
> +++ b/dlls/riched20/txtsrv.c
> @@ -261,6 +261,9 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetText(ITextServices *iface, BSTR *p
>     ITextServicesImpl *This = impl_from_ITextServices(iface);
>     int length;
>  
> +   if (!pbstrText)
> +       return E_INVALIDARG;
> +
>     length = ME_GetTextLength(This->editor);
>     if (length)
>     {

Does an application actually need this?

Huw.



More information about the wine-devel mailing list