richedit: Add bounds checks for EM_GETTEXTRANGE with tests.
commitcaca4860290013b8fcf63a101d314346f870cbf4
authorDylan Smith <dylan.ah.smith@gmail.com>
Mon, 23 Mar 2009 04:14:33 +0000 (23 00:14 -0400)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 23 Mar 2009 12:26:28 +0000 (23 13:26 +0100)
tree1cf70de6fdfc12ad0a700b4d9d8f14fd54b78ca3
parent4544efc9724fd49e2dec9544971bd8069f1ee145
richedit: Add bounds checks for EM_GETTEXTRANGE with tests.

Wine was not doing bounds checks for EM_GETTEXTRANGE, which was causing
a crash in Bug 17822.  The added tests would cause a crash without the
added bounds checks in the richedit code.

The bounds checks I put in HandleMessage, since ME_GetTextRange is also
called for ME_GETSELTEXT which should not have bounds checks, since it
uses the selection range.

When the ME_GETTEXTRANGE message returns 0, no text is copied, not even
the NULL terminating charter.  This differs from EM_GETSELTEXT which
will copy the NULL terminating character when no text is selected.  This
behaviour is consistent with native richedit controls.
dlls/riched20/editor.c
dlls/riched20/tests/editor.c