sdiff: fix wcwidth recursion
authorJohn Marino <draco@marino.st>
Wed, 12 Oct 2011 22:39:51 +0000 (00:39 +0200)
committerJohn Marino <draco@marino.st>
Thu, 13 Oct 2011 00:04:49 +0000 (02:04 +0200)
commitd76863bd1dbf9c1e4c04a977e3a7271a23cdb718
treefed153492fb692211a2a5e3bda080f8871442e64
parent7f2a88081375a034b64135fe7adf773ab4a85f62
sdiff: fix wcwidth recursion

Apparently trying to diff non-UTF8 documents caused a stack overflow.
The culprit was correctly identified by Yonetani as the redefinition
of wcwidth in the wcwidth.c file.  Within that function, it calls itself
recursively forever.  I'm not sure how this would work differently
(macro or not) on another system.

My solution was to stop redefining wcwidth and just create a separate
function, one that will call the system wcwidth function as needed.

reported by: Peter Avalos
http://bugs.dragonflybsd.org/issue2134
contrib/diffutils/README.DRAGONFLY
contrib/diffutils/lib/wcwidth.c
contrib/diffutils/src/side.c
gnu/usr.bin/diff/libdiffutils/gnuwidechar.h [new file with mode: 0644]