Bug#302389: incorrect use of varargs in g_build_path, which breaks on (at least) powerpc

Wouter Verhelst Wouter Verhelst <wouter@debian.org>, 302389@bugs.debian.org
Thu, 31 Mar 2005 17:40:28 +0200


Package: libglib2.0-0
Version: 2.6.3-1
Severity: normal

Hi,

stdarg(3) says, about va_arg:

       If  there  is  no  next argument, or if type is not compatible with the
       type of the actual next argument (as promoted according to the  default
       argument promotions), random errors will occur.

And yet, the file gfileutils.c contains (starting line 1140):

      if (next_element)
	{
	  element = next_element;
	  next_element = va_arg (args, gchar *);
	}
      else
	break;

which seems to try to find out whether there are any further arguments
by checking if the return value of va_arg is anything but NULL. This
isn't correct; it probably works on the developer's system, but on my
PowerBook the result is stack corruption and segfaults.

Fixing this would probably need an API change, unfortunately.

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: powerpc (ppc)
Kernel: Linux 2.6.11.6
Locale: LANG=nl_BE.UTF-8@euro, LC_CTYPE=nl_BE.UTF-8@euro (charmap=UTF-8)

Versions of packages libglib2.0-0 depends on:
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an

-- no debconf information