source: clfs-sysroot/patches/glibc-2.6-localedef_segfault-1.patch @ 00520f6

Last change on this file since 00520f6 was 00520f6, checked in by Joe Ciccone <jciccone@…>, 17 years ago

Update patches.

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[8f3d581]1Submitted By: Jim Gifford (patches at jg555 dot com)
[00520f6]2Date: 2007-05-19
3Initial Package Version: 2.6
[8f3d581]4Origin: Debian
5Upstream Status: Unknown
6Description: Fixes Segfault when using localdef.
7             This problem is only noticed when using PaX
8             and some architectures besides x86.
9             See debian bug # 231438
10
[00520f6]11diff -Naur glibc-2.6.orig/locale/programs/3level.h glibc-2.6/locale/programs/3level.h
12--- glibc-2.6.orig/locale/programs/3level.h     2005-12-06 21:47:27.000000000 -0800
13+++ glibc-2.6/locale/programs/3level.h  2007-05-19 13:38:01.000000000 -0700
14@@ -202,6 +202,42 @@
[8f3d581]15        }
16     }
17 }
18+
19+/* GCC ATM seems to do a poor job with pointers to nested functions passed
20+   to inlined functions.  Help it a little bit with this hack.  */
21+#define wchead_table_iterate(tp, fn) \
22+do                                                                           \
23+  {                                                                          \
24+    struct wchead_table *t = (tp);                                           \
25+    uint32_t index1;                                                         \
26+    for (index1 = 0; index1 < t->level1_size; index1++)                              \
27+      {                                                                              \
28+       uint32_t lookup1 = t->level1[index1];                                 \
29+       if (lookup1 != ((uint32_t) ~0))                                       \
30+         {                                                                   \
31+           uint32_t lookup1_shifted = lookup1 << t->q;                       \
32+           uint32_t index2;                                                  \
33+           for (index2 = 0; index2 < (1 << t->q); index2++)                  \
34+             {                                                               \
35+               uint32_t lookup2 = t->level2[index2 + lookup1_shifted];       \
36+               if (lookup2 != ((uint32_t) ~0))                               \
37+                 {                                                           \
38+                   uint32_t lookup2_shifted = lookup2 << t->p;               \
39+                   uint32_t index3;                                          \
40+                   for (index3 = 0; index3 < (1 << t->p); index3++)          \
41+                     {                                                       \
42+                       struct element_t *lookup3                             \
43+                         = t->level3[index3 + lookup2_shifted];              \
44+                       if (lookup3 != NULL)                                  \
45+                         fn ((((index1 << t->q) + index2) << t->p) + index3, \
46+                             lookup3);                                       \
47+                     }                                                       \
48+                 }                                                           \
49+             }                                                               \
50+         }                                                                   \
51+      }                                                                              \
52+  } while (0)
53+
54 #endif
55 
56 #ifndef NO_FINALIZE
Note: See TracBrowser for help on using the repository browser.