aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2013-08-16 14:52:25 -0400
committerMike Frysinger <vapier@gentoo.org>2014-02-08 09:20:56 -0500
commitce3e26b03abb5d1f20117fa3e80b31bfee53ee33 (patch)
tree69282c021631a9b09742682b5a6e866eedfb2834
parent0371345ce892d174f344d0f912419f4a5b3c8954 (diff)
downloadglibc-ce3e26b03abb5d1f20117fa3e80b31bfee53ee33.tar
glibc-ce3e26b03abb5d1f20117fa3e80b31bfee53ee33.tar.gz
glibc-ce3e26b03abb5d1f20117fa3e80b31bfee53ee33.tar.bz2
glibc-ce3e26b03abb5d1f20117fa3e80b31bfee53ee33.zip
Fix localedef segfault when run under exec-shield, PaX or similar
http://bugs.debian.org/198099 http://bugs.debian.org/231438
-rw-r--r--locale/programs/3level.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/locale/programs/3level.h b/locale/programs/3level.h
index c83cdf205e..1d4553e512 100644
--- a/locale/programs/3level.h
+++ b/locale/programs/3level.h
@@ -204,6 +204,42 @@ CONCAT(TABLE,_iterate) (struct TABLE *t,
}
}
}
+
+/* GCC ATM seems to do a poor job with pointers to nested functions passed
+ to inlined functions. Help it a little bit with this hack. */
+#define wchead_table_iterate(tp, fn) \
+do \
+ { \
+ struct wchead_table *t = (tp); \
+ uint32_t index1; \
+ for (index1 = 0; index1 < t->level1_size; index1++) \
+ { \
+ uint32_t lookup1 = t->level1[index1]; \
+ if (lookup1 != ((uint32_t) ~0)) \
+ { \
+ uint32_t lookup1_shifted = lookup1 << t->q; \
+ uint32_t index2; \
+ for (index2 = 0; index2 < (1 << t->q); index2++) \
+ { \
+ uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \
+ if (lookup2 != ((uint32_t) ~0)) \
+ { \
+ uint32_t lookup2_shifted = lookup2 << t->p; \
+ uint32_t index3; \
+ for (index3 = 0; index3 < (1 << t->p); index3++) \
+ { \
+ struct element_t *lookup3 \
+ = t->level3[index3 + lookup2_shifted]; \
+ if (lookup3 != NULL) \
+ fn ((((index1 << t->q) + index2) << t->p) + index3, \
+ lookup3); \
+ } \
+ } \
+ } \
+ } \
+ } \
+ } while (0)
+
#endif
#ifndef NO_ADD_LOCALE