Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Jul 2002 04:35:42 +0200 (CEST)
From:      Christian Weisgerber <naddy@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/41075: devel/gmake segfaults in non-default locale
Message-ID:  <200207280235.g6S2Zg59047420@kemoauc.mips.inka.de>

next in thread | raw e-mail | index | archive | help

>Number:         41075
>Category:       ports
>Synopsis:       devel/gmake segfaults in non-default locale
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jul 27 20:40:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Christian Weisgerber
>Release:        FreeBSD 5.0-CURRENT alpha
>Organization:
>Environment:
System: FreeBSD kemoauc.mips.inka.de 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Sat Jul 27 13:35:17 CEST 2002 naddy@kemoauc.mips.inka.de:/usr/obj/usr/src/sys/KEMOAUC alpha

>Description:

gmake segfaults on start-up if run with a locale other than the
default "C".

Specifically, in gettext.c:read_alias_file(), alias entries are
handled as a map of alias/value pairs, which are pointers into a
string pool where the actual string data is stored.  When the string
pool is full it is realloc()ed but the pointers to the data are not
updated.

The fix below is taken from the head of the glibc CVS repository
(where gettext.c is from).  It updates the pointers into the
realloc()ed area.

>How-To-Repeat:

$ LANG=en_US.ISO8859-15 gmake --version

>Fix:

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/devel/gmake/Makefile,v
retrieving revision 1.40
diff -u -r1.40 Makefile
--- Makefile	6 Jun 2002 22:40:39 -0000	1.40
+++ Makefile	28 Jul 2002 02:23:26 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	gmake
 PORTVERSION=	3.79.1
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	devel
 MASTER_SITES=	${MASTER_SITE_GNU}
 MASTER_SITE_SUBDIR=	make
Index: files/patch-gettext.c
===================================================================
RCS file: /home/ncvs/ports/devel/gmake/files/patch-gettext.c,v
retrieving revision 1.1
diff -u -r1.1 patch-gettext.c
--- files/patch-gettext.c	6 Jun 2002 22:40:06 -0000	1.1
+++ files/patch-gettext.c	28 Jul 2002 02:23:26 -0000
@@ -1,8 +1,8 @@
 
-$FreeBSD: ports/devel/gmake/files/patch-gettext.c,v 1.1 2002/06/06 22:40:06 sobomax Exp $
+$FreeBSD$
 
---- gettext.c	2002/06/06 22:10:23	1.1
-+++ gettext.c	2002/06/06 22:11:09
+--- gettext.c.orig	Wed Feb  9 08:02:18 2000
++++ gettext.c	Sun Jul 28 04:22:31 2002
 @@ -22,6 +22,10 @@
  # include <config.h>
  #endif
@@ -14,3 +14,19 @@
  #ifdef __GNUC__
  # define alloca __builtin_alloca
  # define HAVE_ALLOCA 1
+@@ -1294,6 +1298,15 @@
+ 		    {
+ 		      FREE_BLOCKS (block_list);
+ 		      return added;
++		    }
++		  if (string_space != new_pool)
++		    {
++		      size_t i;
++		      for (i = 0; i < nmap; i++)
++			{
++			  map[i].alias += new_pool - string_space;
++			  map[i].value += new_pool - string_space;
++			}
+ 		    }
+ 		  string_space = new_pool;
+ 		  string_space_max = new_size;
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207280235.g6S2Zg59047420>