ICU: Fix crash in codecForMib(2107)
availableMibs() unconditionally adds 2107 to the list of mibs. The patch ensures that codecForMib() also knows about this special TSCII codec. (Note that the autotest only really checks this code path if only this test case is run. The other tests already fill the internal codec cache otherwise). Change-Id: Id987d7cecd5f5700cca75e9b85b37011f8e5c622 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
e9bc07c4f2
commit
e177a35dfe
@ -530,6 +530,10 @@ QTextCodec *QIcuCodec::codecForMibUnlocked(int mib)
|
||||
if (mibToName[i].mib == mib)
|
||||
return codecForNameUnlocked(mibToNameTable + mibToName[i].index);
|
||||
}
|
||||
|
||||
if (mib == 2107)
|
||||
return codecForNameUnlocked("TSCII");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,7 @@ private slots:
|
||||
void decode0D() const;
|
||||
void aliasForUTF16() const;
|
||||
void mibForTSCII() const;
|
||||
void codecForTSCII() const;
|
||||
|
||||
void utf8Codec_data();
|
||||
void utf8Codec();
|
||||
@ -513,6 +514,13 @@ void tst_QTextCodec::mibForTSCII() const
|
||||
QCOMPARE(codec->mibEnum(), 2107);
|
||||
}
|
||||
|
||||
void tst_QTextCodec::codecForTSCII() const
|
||||
{
|
||||
QTextCodec *codec = QTextCodec::codecForMib(2107);
|
||||
QVERIFY(codec);
|
||||
QCOMPARE(codec->mibEnum(), 2107);
|
||||
}
|
||||
|
||||
static QString fromInvalidUtf8Sequence(const QByteArray &ba)
|
||||
{
|
||||
return QString().fill(QChar::ReplacementCharacter, ba.size());
|
||||
|
Loading…
Reference in New Issue
Block a user