[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r13812 - in /fsf/trunk/libc: ./ iconvdata/ libio/ sysdeps/generic/elf/ sysdeps/ia64/



Author: eglibc
Date: Sat May 14 09:08:06 2011
New Revision: 13812

Log:
Import glibc-mainline for 2011-05-14

Added:
    fsf/trunk/libc/iconvdata/bug-iconv8.c   (with props)
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/iconvdata/Makefile
    fsf/trunk/libc/iconvdata/cp932.c
    fsf/trunk/libc/libio/fileops.c
    fsf/trunk/libc/sysdeps/generic/elf/backtracesymsfd.c
    fsf/trunk/libc/sysdeps/ia64/backtrace.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat May 14 09:08:06 2011
@@ -1,4 +1,23 @@
 2011-05-14  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[BZ #12601]
+	* iconvdata/cp932.c (BODY to UCS4): Fix incrementing inptr in case of
+	two-byte sequence errors.
+	* iconvdata/Makefile (tests): Add bug-iconv8.
+	* iconvdata/bug-iconv8.c: New file.
+
+	[BZ #12626]
+	* sysdeps/generic/elf/backtracesymsfd.c (__backtrace_symbols_fd): Move
+	buf2 definition.
+
+	* libio/fileops.c (_IO_new_file_close_it): Initialize write_status.
+
+	[BZ #12432]
+	* sysdeps/ia64/backtrace.c (struct trace_reg): Add cfa element.
+	(dummy_getcfa): New function.
+	(init): Get _Unwind_GetCFA address, use dummy if not found.
+	(backtrace_helper): In recursion check, also check whether CFA changes.
+	(__backtrace): Completely initialize arg.
 
 	* iconv/loop.c (SINGLE) [STORE_REST]: Add input bytes to bytebuf before
 	storing incomplete byte sequence in state object.  Avoid testing for

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Sat May 14 09:08:06 2011
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2011-5-13
+GNU C Library NEWS -- history of user-visible changes.  2011-5-14
 Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -10,11 +10,11 @@
 * The following bugs are resolved with this release:
 
   386, 11257, 11258, 11487, 11532, 11578, 11653, 11668, 11724, 11945, 11947,
-  12052, 12158, 12178, 12200, 12346, 12393, 12420, 12445, 12449, 12454,
-  12460, 12469, 12489, 12509, 12510, 12511, 12518, 12527, 12541, 12545,
-  12551, 12583, 12587, 12597, 12611, 12625, 12631, 12650, 12653, 12655,
-  12660, 12681, 12685, 12711, 12713, 12714, 12717, 12723, 12724, 12734,
-  12738
+  12052, 12158, 12178, 12200, 12346, 12393, 12420, 12432, 12445, 12449,
+  12454, 12460, 12469, 12489, 12509, 12510, 12511, 12518, 12527, 12541,
+  12545, 12551, 12583, 12587, 12597, 12601, 12611, 12625, 12626, 12631,
+  12650, 12653, 12655, 12660, 12681, 12685, 12711, 12713, 12714, 12717,
+  12723, 12724, 12734, 12738
 
 * The RPC implementation in libc is obsoleted.  Old programs keep working
   but new programs cannot be linked with the routines in libc anymore.

Modified: fsf/trunk/libc/iconvdata/Makefile
==============================================================================
--- fsf/trunk/libc/iconvdata/Makefile (original)
+++ fsf/trunk/libc/iconvdata/Makefile Sat May 14 09:08:06 2011
@@ -68,7 +68,7 @@
 
 ifeq (yes,$(build-shared))
 tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
-	tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7
+	tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8
 ifeq ($(have-thread-library),yes)
 tests += bug-iconv3
 endif

Added: fsf/trunk/libc/iconvdata/bug-iconv8.c
==============================================================================
--- fsf/trunk/libc/iconvdata/bug-iconv8.c (added)
+++ fsf/trunk/libc/iconvdata/bug-iconv8.c Sat May 14 09:08:06 2011
@@ -1,0 +1,43 @@
+// BZ 12601
+#include <stdio.h>
+#include <errno.h>
+#include <iconv.h>
+
+static int
+do_test (void)
+{
+   iconv_t cd;
+   char in[] = "\x83\xd9";
+   char out[256];
+   char *inbuf;
+   size_t inbytesleft;
+   char *outbuf;
+   size_t outbytesleft;
+   size_t ret;
+
+   inbuf = in;
+   inbytesleft = sizeof(in) - 1;
+   outbuf = out;
+   outbytesleft = sizeof(out);
+
+   cd = iconv_open("utf-8", "cp932");
+   ret = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
+   iconv_close(cd);
+
+   printf("result: %ld %d %ld %d\n", ret, errno, inbytesleft, inbuf[0]);
+
+   /*
+    * result: -1 84 0 0        (84=EILSEQ)
+    *
+    * Error is returnd but inbuf is consumed.
+    *
+    * \x83\xd9 is valid shift-jis sequence but no character is assigned
+    * to it.
+    */
+
+   return (ret != -1 || errno != EILSEQ
+	   || inbytesleft != 2 || inbuf[0] != in[0]);
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Propchange: fsf/trunk/libc/iconvdata/bug-iconv8.c
------------------------------------------------------------------------------
    svn:mime-type = text/cpp

Modified: fsf/trunk/libc/iconvdata/cp932.c
==============================================================================
--- fsf/trunk/libc/iconvdata/cp932.c (original)
+++ fsf/trunk/libc/iconvdata/cp932.c Sat May 14 09:08:06 2011
@@ -1,5 +1,5 @@
 /* Mapping tables for CP932 handling.
-   Copyright (C) 1997,1998,1999,2000,2001,2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2001,2003,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by MORIYAMA Masayuki <msyk@xxxxxxxxxxxxxxxxx>, 2003.
 
@@ -4549,8 +4549,8 @@
       ++inptr;								      \
     else if (ch >= 0xa1 && ch <= 0xdf)                                        \
       {                                                                       \
-        ch += 0xfec0;                                                         \
-        ++inptr;                                                              \
+	ch += 0xfec0;                                                         \
+	++inptr;                                                              \
       }									      \
     else if (__builtin_expect (ch, 0) == 0xa0				      \
 	     || __builtin_expect (ch <= 0x80, 0)			      \
@@ -4588,65 +4588,63 @@
 	if (__builtin_expect (ch2 < 0x40, 0)				      \
 	    || __builtin_expect (ch2 > 0xfc, 0)				      \
 	    || __builtin_expect (ch2 == 0x7f, 0)			      \
-	    || (__builtin_expect (idx > 0x84be, 0) && idx < 0x8740)      \
-	    || (__builtin_expect (idx > 0x879c, 0) && idx < 0x889f)      \
-	    || (__builtin_expect (idx > 0x88fc, 0) && idx < 0x8940)      \
-	    || (__builtin_expect (idx > 0x9ffc, 0) && idx < 0xe040)      \
-	    || (__builtin_expect (idx > 0xeaa4, 0) && idx < 0xed40)      \
-	    || (__builtin_expect (idx > 0xeefc, 0) && idx < 0xf040)      \
+	    || (__builtin_expect (idx > 0x84be, 0) && idx < 0x8740)	      \
+	    || (__builtin_expect (idx > 0x879c, 0) && idx < 0x889f)	      \
+	    || (__builtin_expect (idx > 0x88fc, 0) && idx < 0x8940)	      \
+	    || (__builtin_expect (idx > 0x9ffc, 0) && idx < 0xe040)	      \
+	    || (__builtin_expect (idx > 0xeaa4, 0) && idx < 0xed40)	      \
+	    || (__builtin_expect (idx > 0xeefc, 0) && idx < 0xf040)	      \
 	    || __builtin_expect (idx > 0xfc4b, 0))			      \
 	  {								      \
 	    /* This is illegal.  */					      \
 	    if (! ignore_errors_p ())					      \
 	      {								      \
-	        /* This is an illegal character.  */			      \
-	        result = __GCONV_ILLEGAL_INPUT;				      \
-	        break;							      \
+		/* This is an illegal character.  */			      \
+		result = __GCONV_ILLEGAL_INPUT;				      \
+		break;							      \
 	      }								      \
 									      \
 	    ++inptr;							      \
 	    ++*irreversible;						      \
 	    continue;							      \
 	  }								      \
+									      \
+	/* We could pack the data a bit more dense.  The second		      \
+	   byte will never be 0x7f and it will also be never		      \
+	   >0xfc.  But this would mean yet more `if's.  */		      \
+	if (idx <= 0x84be)						      \
+	  ch = cjk_block1[(ch - 0x81) * 192 + ch2 - 0x40];		      \
+	else if (idx <= 0x879c)						      \
+	  ch = cjk_block2[(ch - 0x87) * 192 + ch2 - 0x40];		      \
+	else if (idx <= 0x88fc)						      \
+	  ch = cjk_block3[(ch - 0x88) * 192 + ch2 - 0x9f];		      \
+	else if (idx <= 0x9ffc)						      \
+	  ch = cjk_block4[(ch - 0x89) * 192 + ch2 - 0x40];		      \
+	else if (idx <= 0xeaa4)						      \
+	  ch = cjk_block5[(ch - 0xe0) * 192 + ch2 - 0x40];		      \
+	else if (idx <= 0xeefc)						      \
+	  ch = cjk_block6[(ch - 0xed) * 192 + ch2 - 0x40];		      \
+	else if (idx <= 0xf9fc)						      \
+	  ch = (ch-0xf0)*188 + ch2-((ch2<0x7f)?0x40:0x41) + 0xe000;	      \
 	else								      \
-	  {								      \
-	    /* We could pack the data a bit more dense.  The second	      \
-	       byte will never be 0x7f and it will also be never	      \
-	       >0xfc.  But this would mean yet more `if's.  */		      \
-	    if (idx <= 0x84be)						      \
-	      ch = cjk_block1[(ch - 0x81) * 192 + ch2 - 0x40];		      \
-	    else if (idx <= 0x879c)					      \
-	      ch = cjk_block2[(ch - 0x87) * 192 + ch2 - 0x40];		      \
-	    else if (idx <= 0x88fc)					      \
-	      ch = cjk_block3[(ch - 0x88) * 192 + ch2 - 0x9f];		      \
-	    else if (idx <= 0x9ffc)					      \
-	      ch = cjk_block4[(ch - 0x89) * 192 + ch2 - 0x40];		      \
-	    else if (idx <= 0xeaa4)					      \
-	      ch = cjk_block5[(ch - 0xe0) * 192 + ch2 - 0x40];		      \
-	    else if (idx <= 0xeefc)					      \
-	      ch = cjk_block6[(ch - 0xed) * 192 + ch2 - 0x40];		      \
-	    else if (idx <= 0xf9fc)					      \
-	      ch = (ch-0xf0)*188 + ch2-((ch2<0x7f)?0x40:0x41) + 0xe000;	      \
-	    else							      \
-	      ch = cjk_block7[(ch - 0xfa) * 192 + ch2 - 0x40];		      \
-									      \
-	    inptr += 2;							      \
-	  }								      \
+	  ch = cjk_block7[(ch - 0xfa) * 192 + ch2 - 0x40];		      \
 									      \
 	if (__builtin_expect (ch, 1) == 0)				      \
 	  {								      \
 	    /* This is an illegal character.  */			      \
 	    if (! ignore_errors_p ())					      \
 	      {								      \
-	        /* This is an illegal character.  */			      \
-	        result = __GCONV_ILLEGAL_INPUT;				      \
-	        break;							      \
+		/* This is an illegal character.  */			      \
+		result = __GCONV_ILLEGAL_INPUT;				      \
+		break;							      \
 	      }								      \
 									      \
 	    inptr += 2;							      \
 	    ++*irreversible;						      \
 	    continue;							      \
 	  }								      \
+									      \
+	inptr += 2;							      \
       }									      \
 									      \
     put32 (outptr, ch);							      \
@@ -4674,7 +4672,7 @@
 	else if (ch >= 0x2010 && ch <= 0x9fa0)				      \
 	  cp = from_ucs4_cjk[ch - 0x2010];				      \
 	else if (ch >= 0xe000 && ch <= 0xe757)				      \
-          {								      \
+	  {								      \
 	    pua[0] = (ch - 0xe000) / 188 + 0xf0;			      \
 	    pua[1] = (ch - 0xe000) % 188 + 0x40;			      \
 	    if (pua[1] > 0x7e)						      \

Modified: fsf/trunk/libc/libio/fileops.c
==============================================================================
--- fsf/trunk/libc/libio/fileops.c (original)
+++ fsf/trunk/libc/libio/fileops.c Sat May 14 09:08:06 2011
@@ -175,6 +175,8 @@
       else
 	write_status = _IO_SYSSEEK (fp, o, SEEK_SET) < 0 ? EOF : 0;
     }
+  else
+    write_status = 0;
 
   INTUSE(_IO_unsave_markers) (fp);
 

Modified: fsf/trunk/libc/sysdeps/generic/elf/backtracesymsfd.c
==============================================================================
--- fsf/trunk/libc/sysdeps/generic/elf/backtracesymsfd.c (original)
+++ fsf/trunk/libc/sysdeps/generic/elf/backtracesymsfd.c Sat May 14 09:08:06 2011
@@ -1,5 +1,5 @@
 /* Write formatted list with names for addresses in backtrace to a file.
-   Copyright (C) 1998,2000,2003,2005,2009 Free Software Foundation, Inc.
+   Copyright (C) 1998,2000,2003,2005,2009,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -28,7 +28,7 @@
 #if __ELF_NATIVE_CLASS == 32
 # define WORD_WIDTH 8
 #else
-/* We assyme 64bits.  */
+/* We assume 64bits.  */
 # define WORD_WIDTH 16
 #endif
 
@@ -45,6 +45,7 @@
   for (cnt = 0; cnt < size; ++cnt)
     {
       char buf[WORD_WIDTH];
+      char buf2[WORD_WIDTH];
       Dl_info info;
       struct link_map *map;
       size_t last = 0;
@@ -59,7 +60,6 @@
 
 	  if (info.dli_sname != NULL || map->l_addr != 0)
 	    {
-	      char buf2[WORD_WIDTH];
 	      size_t diff;
 
 	      iov[last].iov_base = (void *) "(";

Modified: fsf/trunk/libc/sysdeps/ia64/backtrace.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ia64/backtrace.c (original)
+++ fsf/trunk/libc/sysdeps/ia64/backtrace.c Sat May 14 09:08:06 2011
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2005, 2007, 2009, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2003.
 
@@ -27,13 +27,25 @@
 struct trace_arg
 {
   void **array;
-  int cnt, size;
+  _Unwind_Word cfa;
+  int cnt;
+  int size;
 };
 
 #ifdef SHARED
 static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *);
 static _Unwind_Ptr (*unwind_getip) (struct _Unwind_Context *);
+static _Unwind_Word (*unwind_getcfa) (struct _Unwind_Context *);
 static void *libgcc_handle;
+
+
+/* Dummy version in case libgcc_s does not contain the real code.  */
+static _Unwind_Word
+dummy_getcfa (struct _Unwind_Context *ctx __attribute__ ((unused)))
+{
+  return 0;
+}
+
 
 static void
 init (void)
@@ -47,10 +59,13 @@
   unwind_getip = __libc_dlsym (libgcc_handle, "_Unwind_GetIP");
   if (unwind_getip == NULL)
     unwind_backtrace = NULL;
+  unwind_getcfa = (__libc_dlsym (libgcc_handle, "_Unwind_GetCFA")
+		   ?: dummy_getcfa);
 }
 #else
 # define unwind_backtrace _Unwind_Backtrace
 # define unwind_getip _Unwind_GetIP
+# define unwind_getcfa _Unwind_GetCFA
 #endif
 
 static _Unwind_Reason_Code
@@ -65,8 +80,12 @@
       arg->array[arg->cnt] = (void *) unwind_getip (ctx);
 
       /* Check whether we make any progress.  */
-      if (arg->cnt > 0 && arg->array[arg->cnt - 1] == arg->array[arg->cnt])
+      _Unwind_Word cfa = unwind_getcfa (ctx);
+
+      if (arg->cnt > 0 && arg->array[arg->cnt - 1] == arg->array[arg->cnt]
+	  && cfa == arg->cfa)
 	return _URC_END_OF_STACK;
+      arg->cfa = cfa;
     }
   if (++arg->cnt == arg->size)
     return _URC_END_OF_STACK;
@@ -78,7 +97,7 @@
      void **array;
      int size;
 {
-  struct trace_arg arg = { .array = array, .size = size, .cnt = -1 };
+  struct trace_arg arg = { .array = array, .cfa = 0, .size = size, .cnt = -1 };
 #ifdef SHARED
   __libc_once_define (static, once);