Summary: | Crash with ISO 2022-JP Charset | ||
---|---|---|---|
Product: | [Applications] konversation | Reporter: | Mikiya Okuno <mikiya.okuno> |
Component: | general | Assignee: | Konversation Developers <konversation-devel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | hein, ottoteixeira |
Priority: | NOR | ||
Version: | 1.6 | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Mikiya Okuno
2016-04-28 10:32:15 UTC
Crash will happen if getCodec() returns null on the following code: uint currentLength = getIdentity()->getCodec()->fromUnicode(channel).length(); getCodec() returns NULL because m_codec is set to NULL in Identity::setCodecName(). In irccharsets.cpp: Why this code? if(shortName == QStringLiteral("ISO 2022-JP")) { return QTextCodec::codecForName( "jis7" ); } That returns NULL. This one: return KCharsets::charsets()->codecForName( shortName.toLatin1() ); Seems to work fine for "Codec = ISO 2022-JP" This is apparently ancient code from 2004 -- it appears QTextCodec::codecForLocale didn't return something sensible for ja_JP back then. I'm inclined to just drop all these hacks 10 years later. codecForLocale() returns UTF-8 for jp_JP on my system, and I'm not up to speed on whether Japanese networks have modernized and stopped defaulting to jis7 these days, so let's keep it for now ... KCharsets::codecForName() works with both "ISO 2022-JP" and "ISO-2022-JP" for me, but returns ISO-8859-1 for jis7, which is ... an interesting development. It means the jis7 option will actually crash currently. I'm changing the jp_JP default from jis7 to ISO-2022-JP and mangling jis7 to ISO-2022-JP (i.e. the reverse of the quoted code), along with adding a fallback to UTF-8 in case of null codecs. |