summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorISHIKAWA,chiaki <ishikawa@yk.rim.or.jp>2012-12-18 15:28:05 +0000
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-08-07 08:32:19 -0700
commit8f58e54a5f46c3cd4897a23b89950f4800ae38d4 (patch)
treed7972e127ce2e6c22c0fc9e9a02598c12bf3bdab
parente7fd6f0eda57300df4d6b695b7064610ca5dec57 (diff)
Fix bogus timestamp generated by XIM
Fix bogus timestamp generted by XIM due to uninitialized data field. Also set appropriate serial, too. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=39367 Signed-off-by: Chiaki ISHIKAWA <ishikawa@yk.rim.or.jp> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--modules/im/ximcp/imDefLkup.c13
-rw-r--r--modules/im/ximcp/imTrans.c8
2 files changed, 21 insertions, 0 deletions
diff --git a/modules/im/ximcp/imDefLkup.c b/modules/im/ximcp/imDefLkup.c
index b5cbfb59..b4315894 100644
--- a/modules/im/ximcp/imDefLkup.c
+++ b/modules/im/ximcp/imDefLkup.c
@@ -269,6 +269,8 @@ _XimForwardEventCore(
int ret_code;
INT16 len;
+ bzero(buf32, sizeof(buf32)); /* valgrind noticed uninitialized memory use! */
+
if (!(len = _XimSetEventToWire(ev, (xEvent *)&buf_s[4])))
return False; /* X event */
@@ -708,6 +710,8 @@ _XimCommitRecv(
& (KEYPRESS_MASK | KEYRELEASE_MASK))
MARK_FABRICATED(im);
+ bzero(&ev, sizeof(ev)); /* uninitialized : found when running kterm under valgrind */
+
ev.type = KeyPress;
ev.send_event = False;
ev.display = im->core.display;
@@ -715,6 +719,15 @@ _XimCommitRecv(
ev.keycode = 0;
ev.state = 0;
+ ev.time = 0L;
+ ev.serial = LastKnownRequestProcessed(im->core.display);
+ /* FIXME :
+ I wish there were COMMENTs (!) about the data passed around.
+ */
+#if 0
+ fprintf(stderr,"%s,%d: putback k press FIXED ev.time=0 ev.serial=%lu\n", __FILE__, __LINE__, ev.serial);
+#endif
+
XPutBackEvent(im->core.display, (XEvent *)&ev);
return True;
diff --git a/modules/im/ximcp/imTrans.c b/modules/im/ximcp/imTrans.c
index 4bdecb2e..a8cd95e8 100644
--- a/modules/im/ximcp/imTrans.c
+++ b/modules/im/ximcp/imTrans.c
@@ -222,12 +222,20 @@ _XimTransInternalConnection(
if (spec->is_putback)
return;
+
+ bzero(&ev, sizeof(ev)); /* FIXME: other fields may be accessed, too. */
kev = (XKeyEvent *)&ev;
kev->type = KeyPress;
kev->send_event = False;
kev->display = im->core.display;
kev->window = spec->window;
kev->keycode = 0;
+ kev->time = 0L;
+ kev->serial = LastKnownRequestProcessed(im->core.display);
+#if 0
+ fprintf(stderr,"%s,%d: putback FIXED kev->time=0 kev->serial=%lu\n", __FILE__, __LINE__, kev->serial);
+#endif
+
XPutBackEvent(im->core.display, &ev);
XFlush(im->core.display);
spec->is_putback = True;