misc/100215: fix to hexdump(1)/od(1) following "UTF-8 zero-width
character patch"
J.R. Oldroyd
fbsd at opal.com
Thu Jul 13 15:20:18 UTC 2006
>Number: 100215
>Category: misc
>Synopsis: fix to hexdump(1)/od(1) following "UTF-8 zero-width character patch"
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Jul 13 15:20:12 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: J.R. Oldroyd
>Release: FreeBSD 6.1-STABLE i386
>Organization:
>Environment:
System: FreeBSD linwhf.opal.com 6.1-STABLE FreeBSD 6.1-STABLE #1: Thu May 18 16:03:24 EDT 2006 xxx at linwhf.opal.com:/usr/obj/usr/src/sys/LINWHF i386
>Description:
This patch fixes a problem in hexdump(1)/od(1) which arises following
the application of the "UTF-8 zero-width character patch":
http://www.freebsd.org/cgi/query-pr.cgi?pr=misc/100212
There is an assertion in hexdump's conv.c to verify that the width
of a character is > 0; this is no longer always the case as some
characters are actually zero width.
>How-To-Repeat:
apply "UTF-8 zero-width character patch", misc/100212
od -c file-containing-zero-width-chars, such as the utf8demo.txt file
mentioned in that patch
The assertion will fail and od will dump core.
>Fix:
--- /usr/src/usr.bin/hexdump/conv.orig Fri Jul 16 07:07:07 2004
+++ /usr/src/usr.bin/hexdump/conv.c Tue Jun 27 15:20:51 2006
@@ -134,7 +134,10 @@
*pr->cchar = 'C';
assert(strcmp(pr->fmt, "%3C") == 0);
width = wcwidth(wc);
- assert(width > 0);
+ if (width == 0) {
+ (void)printf(" ");
+ width = 1;
+ }
pad = 3 - width;
if (pad < 0)
pad = 0;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list