On Fri, Dec 08, 2017 at 02:30:00PM -0500, Phil Susi wrote: > 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?
Maybe declare unprintable characters a lost cause? Use wcswidth unless it returns -1 and then fall back to wcswidth? So usually the columns will align, except in rare (hopefully!) cases when they won't, but at least it won't crash. -- Brian C. Lane (PST8PDT)

