[parted-devel] wcslwidth and the width of non ascii characters

Phil Susi psusi at ubuntu.com
Fri Dec 8 19:30:00 UTC 2017


So this crash was being caused by parted/table.c calling wcswidth() as
part of how it calculates how much whitespace to pad the column out
with.  It seems that wcswidth returns -1 if it finds a non printable
character, which causes the padding to overflow the buffer and corrupt
memory.  I can fix that by switching to wcslen(), but then the columns
are no longer lined up properly.

It appears this is because these Kanji(?) characters are actually extra
wide, despite supposedly being a fixed width font.  It seems as though
wcswidth() knows this and takes it into account, but it blows up on non
printable characters.

Any idea how to get the correct width even with non printable characters
present?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20171208/2747ec23/attachment.sig>


More information about the parted-devel mailing list