This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


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

gconv_open bug uncovered by gettext



During "make install" with OUTPUT_CHARSET=ISO-8859-1, zic crashes with
the following backtrace.

Program received signal SIGSEGV, Segmentation fault.
0x400d4849 in __gconv_close_transform (steps=0x40104962, nsteps=3221225399)
    at gconv_db.c:715
715         if (steps[nsteps].__shlib_handle != NULL
(gdb) where
#0  0x400d4849 in __gconv_close_transform (steps=0x40104962, nsteps=3221225399)
    at gconv_db.c:715
#1  0x400d367f in __gconv_open (toset=0xbfffd1bc "ISO-8859-1//", 
    fromset=0xbfffffb8 "TPUT_CHARSET=ISO-8859-1", handle=0x8050dbc, flags=1)
    at gconv_open.c:112
#2  0x40036fa4 in _nl_load_domain (domain_file=0x8050d78) at loadmsgcat.c:320
#3  0x40036a3e in _nl_find_domain (
    dirname=0x401048c0 "/packages/libc6/share/locale", locale=0xbfffd2ec "de", 
    domainname=0xbfffd2fc "LC_MESSAGES/libc.mo", domainbinding=0x0)
    at finddomain.c:177
#4  0x40035d5d in __dcigettext (domainname=0x804f488 "libc", 
    msgid1=0x804dda0 "invalid time of day", msgid2=0x0, plural=0, n=0, 
    category=5) at dcigettext.c:542
#5  0x4003560d in __dcgettext (domainname=0x804f488 "libc", 
    msgid=0x804dda0 "invalid time of day", category=5) at dcgettext.c:53
#6  0x804a81c in inleap (fields=0x8050cc0, nfields=7) at zic.c:1169
#7  0x8049b32 in infile (name=0xbffff74b "leapseconds") at zic.c:869
#8  0x8049056 in main (argc=8, argv=0xbffff524) at zic.c:548

__gconv_open has been called with arguments "ISO-8859-1//" and "ISO-8859-1//"
and GCONV_AVOID_NOCONV. __gconv_find_transform therefore returned
__GCONV_NOCONV. __gconv_open now tries to clean up, using the uninitialized
values 'steps' and 'nsteps'. But there is nothing to clean up: In all the
cases where __gconv_find_transform returns != __GCONV_OK, it has already
cleaned up everything itself.


2000-05-06  Bruno Haible  <haible@clisp.cons.org>

	* iconv/gconv_open.c (__gconv_open): If __gconv_find_transform
	returned != __GCONV_OK, there is nothing to clean up.

*** iconv/gconv_open.c.bak	Fri Mar 17 00:10:41 2000
--- iconv/gconv_open.c	Sat May  6 17:39:53 2000
***************
*** 93,117 ****
  	  result->__data[cnt].__internal_use = 0;
  	  result->__data[cnt].__statep = &result->__data[cnt].__state;
  	}
-     }
  
!   if (res != __GCONV_OK)
!     {
!       /* Something went wrong.  Free all the resources.  */
!       int serrno = errno;
! 
!       if (result != NULL)
  	{
! 	  while (cnt-- > 0)
! 	    free (result->__data[cnt].__outbuf);
  
! 	  free (result);
! 	  result = NULL;
! 	}
  
!       __gconv_close_transform (steps, nsteps);
  
!       __set_errno (serrno);
      }
  
    *handle = result;
--- 93,117 ----
  	  result->__data[cnt].__internal_use = 0;
  	  result->__data[cnt].__statep = &result->__data[cnt].__state;
  	}
  
!       if (res != __GCONV_OK)
  	{
! 	  /* Something went wrong.  Free all the resources.  */
! 	  int serrno = errno;
  
! 	  if (result != NULL)
! 	    {
! 	      while (cnt-- > 0)
! 		free (result->__data[cnt].__outbuf);
  
! 	      free (result);
! 	      result = NULL;
! 	    }
  
! 	  __gconv_close_transform (steps, nsteps);
! 
! 	  __set_errno (serrno);
! 	}
      }
  
    *handle = result;

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