patches/glibc/2.1.3/rh62-10-glibc-2.1.3-xdr_array.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue May 08 17:48:32 2007 +0000 (2007-05-08)
changeset 78 c3868084d81a
permissions -rw-r--r--
Huge fixes to glibc build, so that we can build at least (and at last):
- use ports addon even when installing headers,
- use optimisation (-O) when installing headers, to avoid unnecessary warnings (thanks Robert P. J. DAY for pointing this out!),
- lowest kernel version to use is only X.Y.Z, not X.Y.Z.T,
- a bit of preparations for NPTL (RSN I hope),
- fix fixing the linker scripts (changing the backup file is kind of useless and stupid);

Shut uClibc finish step: there really is nothing to do;

Add a patch for glibc-2.3.6 weak aliases handling on some archs (ARM and ALPHA at least);

Did not catch the make errors: fixed the pattern matching in scripts/functions;

Introduce a new log level, ALL:
- send components' build messages there,
- DEBUG log level is destined only for crosstool-NG debug messages,
- migrate sub-actions to use appropriate log levels;

Update the armeb-unknown-linux-gnu sample:
- it builds!
- uses gcc-4.0.4 and glibc-2.3.6,
- updated to latest config options set.
yann@1
     1
--- glibc-2.1.3/sunrpc/rpc/types.h	Fri Oct 16 13:43:49 1998
yann@1
     2
+++ glibc-2.1.3/sunrpc/rpc/types.h	Thu Aug  1 09:06:38 2002
yann@1
     3
@@ -55,6 +55,10 @@
yann@1
     4
 
yann@1
     5
 #include <stdlib.h>		/* For malloc decl.  */
yann@1
     6
 #define mem_alloc(bsize)	malloc(bsize)
yann@1
     7
+/*
yann@1
     8
+ * XXX: This must not use the second argument, or code in xdr_array.c needs
yann@1
     9
+ * to be modified.
yann@1
    10
+ */
yann@1
    11
 #define mem_free(ptr, bsize)	free(ptr)
yann@1
    12
 
yann@1
    13
 #ifndef makedev /* ie, we haven't already included it */
yann@1
    14
--- glibc-2.1.3/sunrpc/xdr_array.c	Thu Jul 16 15:23:51 1998
yann@1
    15
+++ glibc-2.1.3/sunrpc/xdr_array.c	Thu Aug  1 09:07:45 2002
yann@1
    16
@@ -44,6 +44,7 @@
yann@1
    17
 #include <string.h>
yann@1
    18
 #include <rpc/types.h>
yann@1
    19
 #include <rpc/xdr.h>
yann@1
    20
+#include <limits.h>
yann@1
    21
 
yann@1
    22
 #define LASTUNSIGNED	((u_int)0-1)
yann@1
    23
 
yann@1
    24
@@ -76,7 +77,11 @@
yann@1
    25
       return FALSE;
yann@1
    26
     }
yann@1
    27
   c = *sizep;
yann@1
    28
-  if ((c > maxsize) && (xdrs->x_op != XDR_FREE))
yann@1
    29
+  /*
yann@1
    30
+   * XXX: Let the overflow possibly happen with XDR_FREE because mem_free()
yann@1
    31
+   * doesn't actually use its second argument anyway.
yann@1
    32
+   */
yann@1
    33
+  if ((c > maxsize || c > UINT_MAX / elsize) && (xdrs->x_op != XDR_FREE))
yann@1
    34
     {
yann@1
    35
       return FALSE;
yann@1
    36
     }