[PATCH] riched20: Return E_INVALIDARG from ITextServices::TxGetText on null output.
Jactry Zeng
jzeng at codeweavers.com
Wed Apr 25 03:33:55 CDT 2018
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)
{
--
2.17.0
More information about the wine-devel
mailing list