Commit 5911f36c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

imm32: Avoid resizing IMCC to zero-size buffer.

parent b012bed6
...@@ -366,7 +366,9 @@ static UINT ime_set_comp_string( HIMC himc, LPARAM lparam ) ...@@ -366,7 +366,9 @@ static UINT ime_set_comp_string( HIMC himc, LPARAM lparam )
if (!(ctx = ImmLockIMC( himc ))) return 0; if (!(ctx = ImmLockIMC( himc ))) return 0;
count = ImeToAsciiEx( VK_PROCESSKEY, lparam, NULL, &buffer.list, 0, himc ); count = ImeToAsciiEx( VK_PROCESSKEY, lparam, NULL, &buffer.list, 0, himc );
if (count >= buffer.uMsgCount) if (!count)
TRACE( "ImeToAsciiEx returned no messages\n" );
else if (count >= buffer.uMsgCount)
WARN( "ImeToAsciiEx returned %#x messages\n", count ); WARN( "ImeToAsciiEx returned %#x messages\n", count );
else if (!(himcc = ImmReSizeIMCC( ctx->hMsgBuf, (ctx->dwNumMsgBuf + count) * sizeof(*msgs) ))) else if (!(himcc = ImmReSizeIMCC( ctx->hMsgBuf, (ctx->dwNumMsgBuf + count) * sizeof(*msgs) )))
WARN( "Failed to resize input context message buffer\n" ); WARN( "Failed to resize input context message buffer\n" );
...@@ -534,7 +536,7 @@ UINT WINAPI ImeToAsciiEx( UINT vkey, UINT vsc, BYTE *state, TRANSMSGLIST *msgs, ...@@ -534,7 +536,7 @@ UINT WINAPI ImeToAsciiEx( UINT vkey, UINT vsc, BYTE *state, TRANSMSGLIST *msgs,
if (!(ctx = ImmLockIMC( himc ))) return 0; if (!(ctx = ImmLockIMC( himc ))) return 0;
if (!(compstr = ImmLockIMCC( ctx->hCompStr ))) goto done; if (!(compstr = ImmLockIMCC( ctx->hCompStr ))) goto done;
size = compstr->dwSize; size = max( compstr->dwSize, sizeof(COMPOSITIONSTRING) );
do do
{ {
......
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