Commit fba43eac authored by Siye Liu's avatar Siye Liu Committed by Commit Bot

Set |pcRunInfoRet| to 0 if |pcchPlainRet| is 0 in |ITextStoreACP::GetText|

TSF on Windows has an assumption that |pcchPlainRet| to be 0 if focused
edit control has no text(empty). Failure to satisfy the assumption may
cause hung (dead looped) in the application when using some legacy IMEs.
Therefore, we should set |pcchPlainRet| to 0 if there is no text in
focused edit control (|pcchPlainRet| is 0).

Bug: 981667
Change-Id: I0e851e9c82e7716c5434cfd8ca93eb1a091d0b79
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1694408
Commit-Queue: Siye Liu <siliu@microsoft.com>
Reviewed-by: default avatarYohei Yukawa <yukawa@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676183}
parent 8c2e19a7
......@@ -263,10 +263,12 @@ STDMETHODIMP TSFTextStore::GetText(LONG acp_start,
text_buffer[i] = result[i];
}
if (run_info_buffer_size) {
if (*text_buffer_copied > 0 && run_info_buffer_size) {
run_info_buffer[0].uCount = *text_buffer_copied;
run_info_buffer[0].type = TS_RT_PLAIN;
*run_info_buffer_copied = 1;
} else {
*run_info_buffer_copied = 0;
}
*next_acp = acp_end;
......
......@@ -273,10 +273,14 @@ class TSFTextStoreTestCallback {
ASSERT_EQ(expected_string.size(), text_buffer_copied);
EXPECT_EQ(expected_string,
base::string16(buffer, buffer + text_buffer_copied));
EXPECT_EQ(1u, run_info_buffer_copied);
EXPECT_EQ(expected_string.size(), run_info.uCount);
EXPECT_EQ(TS_RT_PLAIN, run_info.type);
EXPECT_EQ(expected_next_acp, next_acp);
if (text_buffer_copied > 0) {
EXPECT_EQ(1u, run_info_buffer_copied);
EXPECT_EQ(expected_string.size(), run_info.uCount);
EXPECT_EQ(TS_RT_PLAIN, run_info.type);
EXPECT_EQ(expected_next_acp, next_acp);
} else {
EXPECT_EQ(0u, run_info_buffer_copied);
}
}
void GetTextErrorTest(LONG acp_start, LONG acp_end, HRESULT error_code) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment