[PATCH] xkb: when copying sections, make sure num_rows is set too.

Peter Hutterer mailinglists at who-t.net
Mon Feb 4 23:30:55 PST 2008


I'm trying to find a nasty bug in MPX and while doing so I stumbled 
across the following issue. when copying the keymap, we copy the rows 
but don't update the num_rows on the dst.

Turns out that if this patch is applied, my code still segfaults but 
somewhere else and it looks more sane now...

I'm not sure if the following patch is correct though. Please review.


 From c439e90f79d9f081ec319b6457cff1d8b2fb44fb Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Tue, 5 Feb 2008 16:01:56 +1030
Subject: [PATCH] xkb: when copying sections, make sure num_rows is set too.

---
  xkb/xkbUtils.c |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 1fb47ed..9f813e5 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -1806,6 +1806,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool 
sendNotifies)
                          return FALSE;
                      dsection->rows = tmp;
                  }
+                dsection->num_rows = ssection->num_rows;
                  for (j = 0, srow = ssection->rows, drow = dsection->rows;
                       j < ssection->num_rows;
                       j++, srow++, drow++) {
-- 
1.5.3




More information about the xorg mailing list