pkgsrc-Bugs archive

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

pkg/43879: gettext-lib miscompiles on DragonFly



>Number:         43879
>Category:       pkg
>Synopsis:       gettext-lib miscompiles on DragonFly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 14 17:35:00 +0000 2010
>Originator:     Francois Tigeot
>Release:        DragonFlyBSD
>Organization:
>Environment:
DragonFly sekishi.zefyris.com 2.7-DEVELOPMENT DragonFly 
v2.7.3.962.gd8d671-DEVELOPMENT #3: Tue Sep 14 11:55:21 CEST 2010     
ftigeot%sekishi.zefyris.com@localhost:/usr/obj/usr/src/sys/BADAXE64  x86_64
>Description:
With a DragonFly/x86-64 system, setting LANG to a non-english locale results in 
an immediate crash of applications using devel/gettext-lib (pretty much 
everything in a modern X11 desktop).

Example with mutt:

$ LANG=fr_FR.UTF-8 mutt
[1]    5541 segmentation fault (core dumped)  LANG=fr_FR.UTF-8 mutt

I have tracked this crash to line 669 of gettext-runtime/intl/dcigettext.c

This line uses a value returned by a previous call of tsearch().
tsearch() is declared in /usr/include/search.h and returns a pointer.

Howewer, search.h is not included in dcigettext.c and thus the compiler 
considers tsearch() returns a value of type int.

With the amd64 ABI, sizeof(int) is less than sizeof(void*). The pointer is 
truncated and the program crashes trying to access a random memory address.

The problem also exists on DragonFly/i386, but on this architecture, 
sizeof(int) and sizeof(void*) are the same and thus the void* to int conversion 
does not results in any ill effects.

The reason <search.h> is not included ultimately lies with the GNU configure 
system. This code is an extract of dcigettext.c:

# if defined HAVE_SEARCH_H
#  include <search.h>
# endif

The inclusion of <search.h> is protected by the HAVE_SEARCH_H symbol. It should 
be defined in an automatically generated file, configure.h but is not.
>How-To-Repeat:
Set LANG to fr_FR.UTF-8
Try to run mail/mutt
>Fix:



Home | Main Index | Thread Index | Old Index