DragonFly BSD
DragonFly bugs List (threaded) for 2011-09
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: [issue2134] sdiff causes stack overflow


From: YONETANI Tomokazu <y0n3t4n1@xxxxxxxxx>
Date: Thu, 22 Sep 2011 14:43:36 +0900

On Wed, Sep 21, 2011 at 04:25:42AM +0000, Peter Avalos (via DragonFly issue tracker) wrote:
> 
> New submission from Peter Avalos <peter@theshell.com>:
> 
> Try this:
> cd /usr/src
> sdiff Makefile.inc1 Makefile_upgrade.inc
> 
> Results in:
> diff: stack overflow

The backtrace looks to me like wcwidth() (in libdiffutils) is making
infinite recursion until the stack exhausts.  Simple workaround is
to remove wcwidth.c from ${SRCS} in the Makefile in libdiffutils.

diff --git a/gnu/usr.bin/diff/libdiffutils/Makefile b/gnu/usr.bin/diff/libdiffutils/Makefile
index 00d8580..82b6532 100644
--- a/gnu/usr.bin/diff/libdiffutils/Makefile
+++ b/gnu/usr.bin/diff/libdiffutils/Makefile
@@ -64,7 +64,6 @@ SRCS=	c-stack.c \
 	timegm.c \
 	uinttostr.c \
 	umaxtostr.c \
-	wcwidth.c \
 	xmalloc.c \
 	xstrtol.c \
 	xstrtol-error.c \


We have similar instance in libgreputils, too.  However, the function
definitions of wcwidth in lib{diff,grep}utils look like this:

  int
  wcwidth (wchar_t wc)
  #undef wcwidth
  {
				:
      /* Otherwise, fall back to the system's wcwidth function.  */
  #if HAVE_WCWIDTH
      return wcwidth (wc);
  #else
      return wc == 0 ? 0 : iswprint (wc) ? 1 : -1;
  #endif
    }
  }

So, maybe we're suppose to define a macro wcwidth() somewhere in one
of the header files to a different name?



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