mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 22:14:34 +00:00
Fix decoding overrun in UTF-8 XIM path
This commit is contained in:
parent
d946337724
commit
97d8ea8119
@ -72,6 +72,7 @@ used by the tests and examples and are not required to build the library.
|
|||||||
- Removed dependency on external OpenGL or OpenGL ES headers
|
- Removed dependency on external OpenGL or OpenGL ES headers
|
||||||
- [Cocoa] Removed support for OS X 10.6
|
- [Cocoa] Removed support for OS X 10.6
|
||||||
- [X11] Bugfix: Monitor connection and disconnection events were not reported
|
- [X11] Bugfix: Monitor connection and disconnection events were not reported
|
||||||
|
- [X11] Bugfix: Decoding of UTF-8 text from XIM could continue past the end
|
||||||
- [WGL] Removed dependency on external WGL headers
|
- [WGL] Removed dependency on external WGL headers
|
||||||
- [GLX] Replaced legacy renderable with `GLXWindow`
|
- [GLX] Replaced legacy renderable with `GLXWindow`
|
||||||
- [GLX] Removed dependency on external GLX headers
|
- [GLX] Removed dependency on external GLX headers
|
||||||
|
@ -896,17 +896,17 @@ static void processEvent(XEvent *event)
|
|||||||
int count;
|
int count;
|
||||||
Status status;
|
Status status;
|
||||||
#if defined(X_HAVE_UTF8_STRING)
|
#if defined(X_HAVE_UTF8_STRING)
|
||||||
char buffer[96];
|
char buffer[100];
|
||||||
char* chars = buffer;
|
char* chars = buffer;
|
||||||
|
|
||||||
count = Xutf8LookupString(window->x11.ic,
|
count = Xutf8LookupString(window->x11.ic,
|
||||||
&event->xkey,
|
&event->xkey,
|
||||||
buffer, sizeof(buffer),
|
buffer, sizeof(buffer) - 1,
|
||||||
NULL, &status);
|
NULL, &status);
|
||||||
|
|
||||||
if (status == XBufferOverflow)
|
if (status == XBufferOverflow)
|
||||||
{
|
{
|
||||||
chars = calloc(count, 1);
|
chars = calloc(count + 1, 1);
|
||||||
count = Xutf8LookupString(window->x11.ic,
|
count = Xutf8LookupString(window->x11.ic,
|
||||||
&event->xkey,
|
&event->xkey,
|
||||||
chars, count,
|
chars, count,
|
||||||
@ -916,6 +916,7 @@ static void processEvent(XEvent *event)
|
|||||||
if (status == XLookupChars || status == XLookupBoth)
|
if (status == XLookupChars || status == XLookupBoth)
|
||||||
{
|
{
|
||||||
const char* c = chars;
|
const char* c = chars;
|
||||||
|
chars[count] = '\0';
|
||||||
while (c - chars < count)
|
while (c - chars < count)
|
||||||
_glfwInputChar(window, decodeUTF8(&c), mods, plain);
|
_glfwInputChar(window, decodeUTF8(&c), mods, plain);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user