summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-libs/glibc/files/2.2.5/glibc-2.2.5.divbyzero.patch')
-rw-r--r--sys-libs/glibc/files/2.2.5/glibc-2.2.5.divbyzero.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys-libs/glibc/files/2.2.5/glibc-2.2.5.divbyzero.patch b/sys-libs/glibc/files/2.2.5/glibc-2.2.5.divbyzero.patch
new file mode 100644
index 000000000000..4dbd2d925af3
--- /dev/null
+++ b/sys-libs/glibc/files/2.2.5/glibc-2.2.5.divbyzero.patch
@@ -0,0 +1,33 @@
+diff -uNr glibc-2.2.5.orig/iconv/skeleton.c glibc-2.2.5/iconv/skeleton.c
+--- glibc-2.2.5.orig/iconv/skeleton.c 2001-07-06 14:54:47.000000000 +1000
++++ glibc-2.2.5/iconv/skeleton.c 2002-08-09 20:28:32.000000000 +1000
+@@ -193,15 +193,20 @@
+ character set we can define RESET_INPUT_BUFFER in a very fast way. */
+ #if !defined RESET_INPUT_BUFFER && !defined SAVE_RESET_STATE
+ # if MIN_NEEDED_FROM == MAX_NEEDED_FROM && MIN_NEEDED_TO == MAX_NEEDED_TO
+-/* We have to use these `if's here since the compiler cannot know that
+- (outbuf - outerr) is always divisible by MIN_NEEDED_TO. */
+-# define RESET_INPUT_BUFFER \
+- if (MIN_NEEDED_FROM % MIN_NEEDED_TO == 0) \
+- *inptrp -= (outbuf - outerr) * (MIN_NEEDED_FROM / MIN_NEEDED_TO); \
+- else if (MIN_NEEDED_TO % MIN_NEEDED_FROM == 0) \
+- *inptrp -= (outbuf - outerr) / (MIN_NEEDED_TO / MIN_NEEDED_FROM); \
+- else \
+- *inptrp -= ((outbuf - outerr) / MIN_NEEDED_TO) * MIN_NEEDED_FROM
++/* We have to use these `#if's here since the compiler cannot know that
++ (outbuf - outerr) is always divisible by MIN_NEEDED_TO. We have to
++ use preprocessor arithmetic and no C code because gcc 3.2 complains
++ about division by zero even in obviously dead code. */
++# if MIN_NEEDED_FROM % MIN_NEEDED_TO == 0
++# define RESET_INPUT_BUFFER \
++ *inptrp -= (outbuf - outerr) * (MIN_NEEDED_FROM / MIN_NEEDED_TO)
++# elif MIN_NEEDED_TO % MIN_NEEDED_FROM == 0
++# define RESET_INPUT_BUFFER \
++ *inptrp -= (outbuf - outerr) / (MIN_NEEDED_TO / MIN_NEEDED_FROM)
++# else
++# define RESET_INPUT_BUFFER \
++ *inptrp -= ((outbuf - outerr) / MIN_NEEDED_TO) * MIN_NEEDED_FROM
++# endif
+ # endif
+ #endif
+