summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-06-05 17:03:41 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-06-05 17:03:41 +0200
commitb598d5a3d9089cefb746e8c98b8438fe73e19452 (patch)
treefbc722032c1b92c7343911d146a9dfcf626e9b17
parente421313eba2ff9795933e98217304296305a3ad3 (diff)
add patch series
-rw-r--r--debian/patches/fix-console0001-console-client-xkb-kstoucs.c-find_ucs-assert-precond.patch32
-rw-r--r--debian/patches/fix-console0002-console-client-Fix-lower-range-of-binary-search.patch47
-rw-r--r--debian/patches/series2
3 files changed, 81 insertions, 0 deletions
diff --git a/debian/patches/fix-console0001-console-client-xkb-kstoucs.c-find_ucs-assert-precond.patch b/debian/patches/fix-console0001-console-client-xkb-kstoucs.c-find_ucs-assert-precond.patch
new file mode 100644
index 00000000..f4f8e12e
--- /dev/null
+++ b/debian/patches/fix-console0001-console-client-xkb-kstoucs.c-find_ucs-assert-precond.patch
@@ -0,0 +1,32 @@
+From dfb9a334a5e7ddf9654cccd0036c342687f6ffbd Mon Sep 17 00:00:00 2001
+From: Diego Nieto Cid <dnietoc@gmail.com>
+Date: Thu, 4 Jun 2015 22:58:09 -0300
+Subject: [PATCH hurd 1/2] * console-client/xkb/kstoucs.c (find_ucs): assert
+ precondition.
+
+---
+ console-client/xkb/kstoucs.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/console-client/xkb/kstoucs.c b/console-client/xkb/kstoucs.c
+index 8471e94..fb62445 100644
+--- a/console-client/xkb/kstoucs.c
++++ b/console-client/xkb/kstoucs.c
+@@ -1,3 +1,5 @@
++#include <assert.h>
++
+ struct ksmap {
+ int keysym;
+ unsigned int ucs;
+@@ -11,6 +13,8 @@ find_ucs (int keysym, struct ksmap *first, struct ksmap *last)
+ {
+ struct ksmap *middle = first + (last - first) / 2;
+
++ assert (first <= last);
++
+ if (middle->keysym == keysym)
+ return middle->ucs; /* base case: needle found. */
+ else if (first == last /* empty search space */
+--
+2.1.4
+
diff --git a/debian/patches/fix-console0002-console-client-Fix-lower-range-of-binary-search.patch b/debian/patches/fix-console0002-console-client-Fix-lower-range-of-binary-search.patch
new file mode 100644
index 00000000..e2ad448f
--- /dev/null
+++ b/debian/patches/fix-console0002-console-client-Fix-lower-range-of-binary-search.patch
@@ -0,0 +1,47 @@
+From e974c4ce05f7dcb5e082084fc69f4b2ff2bc891d Mon Sep 17 00:00:00 2001
+From: Diego Nieto Cid <dnietoc@gmail.com>
+Date: Thu, 4 Jun 2015 22:58:10 -0300
+Subject: [PATCH hurd 2/2] console-client: Fix lower range of binary search
+
+To prevent infinite recursion range checking was introduced
+as an exit condition adding two extra comparisons on each
+recursive call.
+
+By fixing the range used by the recursive call over the lower
+half of the array one can avoid penalizing successful lookups
+while still preventing infinite recursion due to `first`
+parameter being greater than `last` parameter.
+
+* console-client/xkb/kstoucs.c (find_ucs): don't remove middle from the
+lower range. Remove extra comparisons.
+---
+ console-client/xkb/kstoucs.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/console-client/xkb/kstoucs.c b/console-client/xkb/kstoucs.c
+index fb62445..eb47bde 100644
+--- a/console-client/xkb/kstoucs.c
++++ b/console-client/xkb/kstoucs.c
+@@ -17,15 +17,15 @@ find_ucs (int keysym, struct ksmap *first, struct ksmap *last)
+
+ if (middle->keysym == keysym)
+ return middle->ucs; /* base case: needle found. */
+- else if (first == last /* empty search space */
+- || keysym < first->keysym /* lookup failure */
+- || keysym > last->keysym) /* lookup failure */
++ else if (first == last) /* empty search space */
+ return 0;
+ /* recursive cases: halve search space. */
+ else if (middle->keysym < keysym)
+ return find_ucs (keysym, middle+1, last);
+ else if (middle->keysym > keysym)
+- return find_ucs (keysym, first, middle-1);
++ /* don't remove middle from the range to compensate
++ for rounding down in it's calculation */
++ return find_ucs (keysym, first, middle);
+ return 0;
+ }
+
+--
+2.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index dbf6a3d9..416b258c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -63,3 +63,5 @@ bootshell0007-XXX-bootshell.patch
bootshell0008-XXX-proc-fix-build.patch
bootshell0009-fixup-more-error-handling.patch
bootshell0010-pull-code-from-livecd-XXX-document.patch
+fix-console0001-console-client-xkb-kstoucs.c-find_ucs-assert-precond.patch
+fix-console0002-console-client-Fix-lower-range-of-binary-search.patch