This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Assorted BP fixes


i686: no build regressions
      no runtime test regressions
      only time/asctime.c has binary differences for non-BP

With this change, 3/4 of the testsuite passes in BP mode.  80% of the
failures are in localedata and have identical (undiagnosed) cause.

The only question I have about this patch is the change to Rules which
creates symlinks from %.input to %-bp.input in the source tree.  Is
that permitted?  If not, I'll need to make symlinks in the build dir
for both BP and non-BP cases, and change the rule so that test
programs take their input from those builddir-resident links.

OK?

2000-07-28  Greg McGary  <greg@mcgary.org>

	* Rules (test-bp-inputs, make-test-out, save-core-dump): New variables.
	($(test-bp-inputs)): New rule.
	($(objpfx)%.out): Rewrite in terms of new variables.

	* libio/iovswscanf.c (vswscanf): Pass _IO_FILE_plus pointer to
	internal function that uses vtable.
	* libio/vsnprintf.c (_IO_vsnprintf): Likewise.
	* libio/vswprintf.c (_IO_vswprintf): Likewise.

	* malloc/malloc.c (mem2chunk): Define in terms of chunk_at_offset.
	(malloc_extend_top): Convert brk to chunk using chunk_at_offset.
	(chunk_align): Likewise.

	* time/asctime.c (ab_day_name, ab_month_name): Rewrite expression
	in a way that conforms to decl, and avoids spurious bounds violation.

	* sysdeps/arm/frame.h (struct layout): Make pointers __unbounded.
	* sysdeps/generic/frame.h: Likewise.
	* sysdeps/generic/backtrace.c (ADVANCE_STACK_FRAME): Wrap bounds
	around return value.
	(__backtrace): Qualify frame-pointer chain and return address
	pointers as __unbounded.  Wrap bounds around variable `current'.
	* sysdeps/generic/segfault.c (ADVANCE_STACK_FRAME): Wrap bounds
	around return value.
	(catch_segfault): Qualify frame-pointer chain and return address
	pointers as __unbounded.  Wrap bounds around variable `current'.
	* sysdeps/i386/backtrace.c (struct layout): Make pointers __unbounded.
	(ADVANCE_STACK_FRAME): Wrap bounds around return value.
	* sysdeps/powerpc/backtrace.c (struct layout): Make pointers __unbounded.
	(__backtrace): Qualify frame-pointer chain and return address
	pointers as __unbounded.  Wrap bounds around variable `current'.

	* sysdeps/i386/addmul_1.S: s2_limb is scalar so remove bounds check.
	* sysdeps/i386/mul_1.S: Likewise.
	* sysdeps/i386/submul_1.S: Likewise.
	* sysdeps/i386/i586/addmul_1.S: Likewise.
	* sysdeps/i386/i586/mul_1.S: Add bounds checks.
	* sysdeps/i386/i586/submul_1.S: Likewise.

Index: Rules
===================================================================
RCS file: /cvs/glibc/libc/Rules,v
retrieving revision 1.96
diff -u -p -r1.96 Rules
--- Rules	2000/07/26 18:18:42	1.96
+++ Rules	2000/07/28 22:10:49
@@ -129,12 +129,22 @@ endif
 ifneq "$(strip $(tests) $(test-srcs))" ""
 # These are the implicit rules for making test outputs
 # from the test programs and whatever input files are present.
+
+test-bp-inputs = $(patsubst %.input,%-bp.input,$(wildcard *.input))
+$(test-bp-inputs): %-bp.input: %.input
+	$(LN_S) $< $@
+
+make-test-out = GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
+		$($(subst -bp,,$*)-ENV) $(built-program-cmd) \
+		$($(subst -bp,,$*)-ARGS)
+save-core-dump = { status=$$?; \
+		   test -f core && mv core $(built-program-file).core; \
+		   exit $$status; }
 $(objpfx)%.out: %.input $(objpfx)%
-	GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
-	  $($*-ENV) $(built-program-cmd) $($*-ARGS) < $(word 1,$^) > $@
+	$(make-test-out) > $@ < $(word 1,$^) || $(save-core-dump)
 $(objpfx)%.out: /dev/null $(objpfx)%	# Make it 2nd arg for canned sequence.
-	GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
-	  $($*-ENV) $(built-program-cmd) $($*-ARGS) > $@
+	$(make-test-out) > $@ || $(save-core-dump)
+
 endif	# tests
 
 .PHONY: distclean realclean subdir_distclean subdir_realclean \
Index: libio/iovswscanf.c
===================================================================
RCS file: /cvs/glibc/libc/libio/iovswscanf.c,v
retrieving revision 1.2
diff -u -p -r1.2 iovswscanf.c
--- iovswscanf.c	1999/08/19 16:38:47	1.2
+++ iovswscanf.c	2000/07/28 22:10:50
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU IO Library.
 
    This library is free software; you can redistribute it and/or
@@ -43,6 +43,6 @@ vswscanf (string, format, args)
   _IO_no_init (&sf._sbf._f, 0, 0, &wd, &_IO_wstr_jumps);
   _IO_fwide (&sf._sbf._f, 1);
   _IO_wstr_init_static (&sf._sbf._f, (wchar_t *)string, 0, NULL);
-  ret = _IO_vfwscanf (&sf._sbf._f, format, args, NULL);
+  ret = _IO_vfwscanf ((_IO_FILE *) &sf._sbf, format, args, NULL);
   return ret;
 }
Index: libio/vsnprintf.c
===================================================================
RCS file: /cvs/glibc/libc/libio/vsnprintf.c,v
retrieving revision 1.13
diff -u -p -r1.13 vsnprintf.c
--- vsnprintf.c	2000/06/29 07:16:41	1.13
+++ vsnprintf.c	2000/07/28 22:10:50
@@ -126,7 +126,7 @@ _IO_vsnprintf (string, maxlen, format, a
   _IO_JUMPS ((struct _IO_FILE_plus *) &sf.f._sbf) = &_IO_strn_jumps;
   string[0] = '\0';
   _IO_str_init_static (&sf.f, string, maxlen - 1, string);
-  ret = _IO_vfprintf (&sf.f._sbf._f, format, args);
+  ret = _IO_vfprintf ((_IO_FILE *) &sf.f._sbf, format, args);
 
   if (sf.f._sbf._f._IO_buf_base != sf.overflow_buf)
     *sf.f._sbf._f._IO_write_ptr = '\0';
Index: libio/vswprintf.c
===================================================================
RCS file: /cvs/glibc/libc/libio/vswprintf.c,v
retrieving revision 1.2
diff -u -p -r1.2 vswprintf.c
--- vswprintf.c	1999/08/19 16:39:32	1.2
+++ vswprintf.c	2000/07/28 22:10:50
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1994, 1997, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU IO Library.
 
    This library is free software; you can redistribute it and/or
@@ -130,7 +130,7 @@ _IO_vswprintf (string, maxlen, format, a
   _IO_fwide (&sf.f._sbf._f, 1);
   string[0] = L'\0';
   _IO_wstr_init_static (&sf.f._sbf._f, string, maxlen - 1, string);
-  ret = _IO_vfwprintf (&sf.f._sbf._f, format, args);
+  ret = _IO_vfwprintf ((_IO_FILE *) &sf.f._sbf, format, args);
 
   if (sf.f._sbf._f._wide_data->_IO_buf_base != sf.overflow_buf)
     *sf.f._sbf._f._wide_data->_IO_write_ptr = '\0';
Index: malloc/malloc.c
===================================================================
RCS file: /cvs/glibc/libc/malloc/malloc.c,v
retrieving revision 1.69
diff -u -p -r1.69 malloc.c
--- malloc.c	2000/07/27 21:55:04	1.69
+++ malloc.c	2000/07/28 22:10:52
@@ -1292,7 +1292,7 @@ static void      free_atfork();
 /* conversion from malloc headers to user pointers, and back */
 
 #define chunk2mem(p) ((Void_t*)((char*)(p) + 2*SIZE_SZ))
-#define mem2chunk(mem) BOUNDED_1((mchunkptr)((char*)(mem) - 2*SIZE_SZ))
+#define mem2chunk(mem) chunk_at_offset((mem), -2*SIZE_SZ)
 
 /* pad request bytes into a usable size, return non-zero on overflow */
 
@@ -2513,7 +2513,7 @@ malloc_extend_top(ar_ptr, nb) arena *ar_
 
       sbrked_mem += correction;
 
-      top(&main_arena) = (mchunkptr)brk;
+      top(&main_arena) = chunk_at_offset(brk, 0);
       top_size = new_brk - brk + correction;
       set_head(top(&main_arena), top_size | PREV_INUSE);
 
@@ -3574,7 +3574,7 @@ arena* ar_ptr; INTERNAL_SIZE_T nb; size_
     brk = (char*)mem2chunk(((m + alignment - 1)) & -(long)alignment);
     if ((long)(brk - (char*)(p)) < (long)MINSIZE) brk += alignment;
 
-    newp = (mchunkptr)brk;
+    newp = chunk_at_offset(brk, 0);
     leadsize = brk - (char*)(p);
     newsize = chunksize(p) - leadsize;
 
Index: sysdeps/arm/frame.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/arm/frame.h,v
retrieving revision 1.1
diff -u -p -r1.1 frame.h
--- frame.h	2000/01/06 00:02:54	1.1
+++ frame.h	2000/07/28 22:10:52
@@ -20,7 +20,7 @@
 /* This is the APCS stack backtrace structure.  */
 struct layout
 {
-  struct layout *next;
-  void *sp;
-  void *return_address;
+  struct layout *__unbounded next;
+  void *__unbounded sp;
+  void *__unbounded return_address;
 };
Index: sysdeps/generic/backtrace.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/backtrace.c,v
retrieving revision 1.5
diff -u -p -r1.5 backtrace.c
--- backtrace.c	2000/01/17 04:02:13	1.5
+++ backtrace.c	2000/07/28 22:10:52
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.  Generic version.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -22,6 +22,7 @@
 #include <signal.h>
 #include <frame.h>
 #include <sigcontextinfo.h>
+#include <bp-checks.h>
 
 /* This is a global variable set at program start time.  It marks the
    highest used stack address.  */
@@ -54,7 +55,7 @@ extern void *__libc_stack_end;
 /* By default assume the `next' pointer in struct layout points to the
    next struct layout.  */
 #ifndef ADVANCE_STACK_FRAME
-# define ADVANCE_STACK_FRAME(next) ((struct layout *) (next))
+# define ADVANCE_STACK_FRAME(next) BOUNDED_1 ((struct layout *) (next))
 #endif
 
 int
@@ -63,15 +64,15 @@ __backtrace (array, size)
      int size;
 {
   struct layout *current;
-  void *top_frame;
-  void *top_stack;
+  void *__unbounded top_frame;
+  void *__unbounded top_stack;
   int cnt = 0;
 
   top_frame = __builtin_frame_address (0);
   top_stack = CURRENT_STACK_FRAME;
 
   /* We skip the call to this function, it makes no sense to record it.  */
-  current = (struct layout *) top_frame;
+  current = BOUNDED_1 ((struct layout *) top_frame);
   while (cnt < size)
     {
       if ((void *) current INNER_THAN top_stack
Index: sysdeps/generic/frame.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/frame.h,v
retrieving revision 1.1
diff -u -p -r1.1 frame.h
--- frame.h	2000/01/06 00:02:37	1.1
+++ frame.h	2000/07/28 22:10:52
@@ -19,6 +19,6 @@
 
 struct layout
 {
-  void *next;
-  void *return_address;
+  void *__unbounded next;
+  void *__unbounded return_address;
 };
Index: sysdeps/generic/segfault.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/segfault.c,v
retrieving revision 1.11
diff -u -p -r1.11 segfault.c
--- segfault.c	2000/01/06 00:03:18	1.11
+++ segfault.c	2000/07/28 22:10:52
@@ -1,5 +1,5 @@
 /* Catch segmentation faults and print backtrace.
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -28,6 +28,8 @@
 #include <unistd.h>
 #include <stdio-common/_itoa.h>
 
+#include <bp-checks.h>
+
 /* Get the definition of "struct layout".  */
 #include <frame.h>
 
@@ -69,7 +71,7 @@ extern void *__libc_stack_end;
 /* By default assume the `next' pointer in struct layout points to the
    next struct layout.  */
 #ifndef ADVANCE_STACK_FRAME
-# define ADVANCE_STACK_FRAME(next) ((struct layout *) (next))
+# define ADVANCE_STACK_FRAME(next) BOUNDED_1 ((struct layout *) (next))
 #endif
 
 /* We'll use tis a lot.  */
@@ -103,8 +105,8 @@ static void
 catch_segfault (int signal, SIGCONTEXT ctx)
 {
   struct layout *current;
-  void *top_frame;
-  void *top_stack;
+  void *__unbounded top_frame;
+  void *__unbounded top_stack;
   int fd;
   void **arr;
   size_t cnt;
@@ -135,7 +137,7 @@ catch_segfault (int signal, SIGCONTEXT c
 
   /* First count how many entries we'll have.  */
   cnt = 1;
-  current = (struct layout *) top_frame;
+  current = BOUNDED_1 ((struct layout *) top_frame);
   while (!((void *) current INNER_THAN top_stack
 	   || !((void *) current INNER_THAN __libc_stack_end)))
     {
@@ -149,7 +151,7 @@ catch_segfault (int signal, SIGCONTEXT c
   /* First handle the program counter from the structure.  */
   arr[0] = GET_PC (ctx);
 
-  current = (struct layout *) top_frame;
+  current = BOUNDED_1 ((struct layout *) top_frame);
   cnt = 1;
   while (!((void *) current INNER_THAN top_stack
 	   || !((void *) current INNER_THAN __libc_stack_end)))
Index: sysdeps/i386/addmul_1.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/addmul_1.S,v
retrieving revision 1.10
diff -u -p -r1.10 addmul_1.S
--- addmul_1.S	2000/06/26 22:14:59	1.10
+++ addmul_1.S	2000/07/28 22:10:52
@@ -51,7 +51,6 @@ ENTRY (BP_SYM (__mpn_addmul_1))
 	shll	$2, %sizeP	/* convert limbs to bytes */
 	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %sizeP)
 	CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %sizeP)
-	CHECK_BOUNDS_BOTH_WIDE (%s2_limb, S2LIMB(%esp), %sizeP)
 	shrl	$2, %sizeP
 #endif
 	leal	(%res_ptr,%sizeP,4), %res_ptr
Index: sysdeps/i386/backtrace.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/backtrace.c,v
retrieving revision 1.3
diff -u -p -r1.3 backtrace.c
--- backtrace.c	1998/06/18 21:47:21	1.3
+++ backtrace.c	2000/07/28 22:10:52
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -19,6 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <execinfo.h>
+#include <bp-checks.h>
 
 
 /* This is a global variable set at program start time.  It marks the
@@ -36,8 +37,8 @@ extern void *__libc_stack_end;
 */
 struct layout
 {
-  struct layout *next;
-  void *return_address;
+  struct layout *__unbounded next;
+  void *__unbounded return_address;
 };
 
 int
@@ -52,7 +53,7 @@ __backtrace (array, size)
   int cnt = 0;
 
   /* We skip the call to this function, it makes no sense to record it.  */
-  current = (struct layout *) ebp;
+  current = BOUNDED_1 ((struct layout *) ebp);
   while (cnt < size)
     {
       if ((void *) current < esp || (void *) current > __libc_stack_end)
Index: sysdeps/i386/mul_1.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/mul_1.S,v
retrieving revision 1.8
diff -u -p -r1.8 mul_1.S
--- mul_1.S	2000/06/26 22:14:59	1.8
+++ mul_1.S	2000/07/28 22:10:52
@@ -51,7 +51,6 @@ ENTRY (BP_SYM (__mpn_mul_1))
 	shll	$2, %size	/* convert limbs to bytes */
 	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size)
 	CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %size)
-	CHECK_BOUNDS_BOTH_WIDE (%s2_limb, S2LIMB(%esp), %size)
 	shrl	$2, %size
 #endif
 	leal	(%res_ptr,%size,4), %res_ptr
Index: sysdeps/i386/submul_1.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/submul_1.S,v
retrieving revision 1.10
diff -u -p -r1.10 submul_1.S
--- submul_1.S	2000/06/26 22:14:59	1.10
+++ submul_1.S	2000/07/28 22:10:52
@@ -51,7 +51,6 @@ ENTRY (BP_SYM (__mpn_submul_1))
 	shll	$2, %sizeP	/* convert limbs to bytes */
 	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %sizeP)
 	CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %sizeP)
-	CHECK_BOUNDS_BOTH_WIDE (%s2_limb, S2LIMB(%esp), %sizeP)
 	shrl	$2, %sizeP
 #endif
 	leal	(%res_ptr,%sizeP,4), %res_ptr
Index: sysdeps/i386/i586/addmul_1.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/addmul_1.S,v
retrieving revision 1.9
diff -u -p -r1.9 addmul_1.S
--- addmul_1.S	2000/06/26 22:15:00	1.9
+++ addmul_1.S	2000/07/28 22:10:53
@@ -51,7 +51,6 @@ ENTRY (BP_SYM (__mpn_addmul_1))
 	shll	$2, %size	/* convert limbs to bytes */
 	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size)
 	CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %size)
-	CHECK_BOUNDS_BOTH_WIDE (%s2_limb, S2LIMB(%esp), %size)
 	shrl	$2, %size
 #endif
 	leal	(%res_ptr,%size,4), %res_ptr
Index: sysdeps/i386/i586/mul_1.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/mul_1.S,v
retrieving revision 1.7
diff -u -p -r1.7 mul_1.S
--- mul_1.S	2000/06/26 18:20:42	1.7
+++ mul_1.S	2000/07/28 22:10:53
@@ -20,6 +20,7 @@
 
 #include "sysdep.h"
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+16	/* space for 4 saved regs */
@@ -34,7 +35,7 @@
 #define s2_limb ebx
 
 	.text
-ENTRY(__mpn_mul_1)
+ENTRY (BP_SYM (__mpn_mul_1))
 	ENTER
 
 	pushl	%edi
@@ -46,7 +47,12 @@ ENTRY(__mpn_mul_1)
 	movl	S1(%esp), %s1_ptr
 	movl	SIZE(%esp), %size
 	movl	S2LIMB(%esp), %s2_limb
-
+#if __BOUNDED_POINTERS__
+	shll	$2, %size	/* convert limbs to bytes */
+	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %size)
+	CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %size)
+	shrl	$2, %size
+#endif
 	leal	(%res_ptr,%size,4), %res_ptr
 	leal	(%s1_ptr,%size,4), %s1_ptr
 	negl	%size
@@ -76,4 +82,4 @@ L(oop):	adcl	$0, %ebp
 	LEAVE
 	ret
 #undef size
-END(__mpn_mul_1)
+END (BP_SYM (__mpn_mul_1))
Index: sysdeps/i386/i586/submul_1.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/i386/i586/submul_1.S,v
retrieving revision 1.7
diff -u -p -r1.7 submul_1.S
--- submul_1.S	2000/06/26 18:20:42	1.7
+++ submul_1.S	2000/07/28 22:10:53
@@ -20,6 +20,7 @@
 
 #include "sysdep.h"
 #include "asm-syntax.h"
+#include "bp-sym.h"
 #include "bp-asm.h"
 
 #define PARMS	LINKAGE+16	/* space for 4 saved regs */
@@ -34,7 +35,7 @@
 #define s2_limb ebx
 
 	.text
-ENTRY(__mpn_submul_1)
+ENTRY (BP_SYM (__mpn_submul_1))
 	ENTER
 
 	pushl	%edi
@@ -46,7 +47,12 @@ ENTRY(__mpn_submul_1)
 	movl	S1(%esp), %s1_ptr
 	movl	SIZE(%esp), %size
 	movl	S2LIMB(%esp), %s2_limb
-
+#if __BOUNDED_POINTERS__
+	shll	$2, %sizeP	/* convert limbs to bytes */
+	CHECK_BOUNDS_BOTH_WIDE (%res_ptr, RES(%esp), %sizeP)
+	CHECK_BOUNDS_BOTH_WIDE (%s1_ptr, S1(%esp), %sizeP)
+	shrl	$2, %sizeP
+#endif
 	leal	(%res_ptr,%size,4), %res_ptr
 	leal	(%s1_ptr,%size,4), %s1_ptr
 	negl	%size
@@ -80,4 +86,4 @@ L(oop):	adcl	$0, %ebp
 	LEAVE
 	ret
 #undef size
-END(__mpn_submul_1)
+END (BP_SYM (__mpn_submul_1))
Index: sysdeps/powerpc/backtrace.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/powerpc/backtrace.c,v
retrieving revision 1.2
diff -u -p -r1.2 backtrace.c
--- backtrace.c	1998/12/11 15:29:27	1.2
+++ backtrace.c	2000/07/28 22:10:53
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,6 +19,7 @@
 
 #include <execinfo.h>
 #include <stddef.h>
+#include <bp-checks.h>
 
 /* This is the stack layout we see with every stack frame.
    Note that every routine is required by the ABI to lay out the stack
@@ -32,8 +33,8 @@
 */
 struct layout
 {
-  struct layout *next;
-  void *return_address;
+  struct layout *__unbounded next;
+  void *__unbounded return_address;
 };
 
 int
@@ -47,10 +48,11 @@ __backtrace (void **array, int size)
 
   /* Get the address on top-of-stack.  */
   asm volatile ("lwz %0,0(1)" : "=r"(current));
+  current = BOUNDED_1 (current);
 
   for (				count = 0;
        current != NULL && 	count < size;
-       current = current->next, count++)
+       current = BOUNDED_1 (current->next), count++)
     array[count] = current->return_address;
 
   /* It's possible the second-last stack frame can't return
Index: time/asctime.c
===================================================================
RCS file: /cvs/glibc/libc/time/asctime.c,v
retrieving revision 1.10
diff -u -p -r1.10 asctime.c
--- asctime.c	1997/07/06 21:54:29	1.10
+++ asctime.c	2000/07/28 22:10:53
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,8 +23,8 @@
 
 /* This is defined in locale/C-time.c in the GNU libc.  */
 extern const struct locale_data _nl_C_LC_TIME;
-#define ab_day_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)].string)
-#define ab_month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)].string)
+#define ab_day_name(DAY) (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)+(DAY)].string)
+#define ab_month_name(MON) (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)+(MON)].string)
 
 static const char format[] = "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n";
 static char result[	         3+1+ 3+1+20+1+20+1+20+1+20+1+20+1 + 1];
@@ -49,9 +49,9 @@ __asctime_r (const struct tm *tp, char *
 
   if (sprintf (buf, format,
 	       (tp->tm_wday < 0 || tp->tm_wday >= 7 ?
-		"???" : ab_day_name[tp->tm_wday]),
+		"???" : ab_day_name (tp->tm_wday)),
 	       (tp->tm_mon < 0 || tp->tm_mon >= 12 ?
-		"???" : ab_month_name[tp->tm_mon]),
+		"???" : ab_month_name (tp->tm_mon)),
 	       tp->tm_mday, tp->tm_hour, tp->tm_min,
 	       tp->tm_sec, 1900 + tp->tm_year) < 0)
     return NULL;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]