Version: (using KDE Devel) Installed from: Compiled sources Opening this binary file: (and others) http://bugs.gentoo.org/attachment.cgi?id=38754&action=view and setting the encoding to iso8859-15 causes a crash with the following backtrace: #5 0x40f73db0 in QLatin15Codec::toUnicode(char const*, int) const () from /usr/qt/3/lib/libqt-mt.so.3 #6 0x40f7153f in QTextStatelessDecoder::toUnicode(char const*, int) () from /usr/qt/3/lib/libqt-mt.so.3 #7 0x41bf5564 in KateFileLoader::readLine() (this=0xbfffd600) at katebuffer.cpp:165 #8 0x41bf239b in KateBufBlock::fillBlock(KateFileLoader*) (this=0x81f69c0, stream=0xbfffd600) at katebuffer.cpp:1123 #9 0x41bf2143 in KateBufBlock (this=0x81f69c0, parent=0xffffff5c, prev=0x0, next=0xffffff5c, stream=0xbfffd600) at katebuffer.cpp:1071 #10 0x41bf0042 in KateBuffer::openFile(QString const&) (this=0x81aad10, m_file=@0x81f69c0) at katebuffer.cpp:437 For reference, the QLatin15Codec::toUnicode function is here: QString QLatin15Codec::toUnicode(const char* chars, int len) const { if ( chars == 0 ) return QString::null; QString str = QString::fromLatin1(chars, len); QChar *uc = (QChar *)str.unicode(); while( len-- ) { switch( uc->unicode() ) { case 0xa4: *uc = 0x20ac; break; [...] case 0xbe: *uc = 0x0178; break; default: break; } uc++; } return str; } Just to know if I get it correctly: kate reads files in chunks and stores them in a QString, so it is expected that when the chunk is from a binary file and contains a '\0' character, the QString is truncated and large part of the data is lost. (This is ok, even if I don't understand why it does happen with QString::fromLatin1 () but not when using QString::fromUtf8() ). But maybe the following patch (against qt-3.3.2) should be sent to Qt to avoid the crash? (tested a bit and seems to work) --- src/codecs/qtextcodec.cpp.orig 2004-09-03 19:46:26.782326976 +0200 +++ src/codecs/qtextcodec.cpp 2004-09-03 19:46:55.388978104 +0200 @@ -2541,6 +2541,7 @@ QString str = QString::fromLatin1(chars, len); QChar *uc = (QChar *)str.unicode(); + len = str.length(); while( len-- ) { switch( uc->unicode() ) { case 0xa4:
other fix in kate part cvs now together with better handling of binary files
*** Bug 93392 has been marked as a duplicate of this bug. ***
Hello, (KDE 3.3.2 SuSE 9.1) I can confirm this - when opening a MPEG file in Konqueror (which, due to wrong MIME types on the server, opens in Kate) the Kate part crashes: Using host libthread_db library "/lib/libthread_db.so.1". [Thread debugging using libthread_db enabled] [New Thread 16384 (LWP 29109)] [KCrash handler] #5 0x40ee1a60 in QLatin15Codec::toUnicode () from /usr/lib/qt3/lib/libqt-mt.so.3 #6 0x40ee169d in QTextStatelessDecoder::toUnicode () from /usr/lib/qt3/lib/libqt-mt.so.3 #7 0x421c31bd in KateFileLoader::open () from /opt/kde3/lib/kde3/libkatepart.so #8 0x085535b8 in ?? () #9 0x4225c008 in ?? () #10 0x00040000 in ?? () #11 0x41296453 in pthread_mutex_unlock () from /lib/libpthread.so.0 #12 0x421de39c in __JCR_LIST__ () from /opt/kde3/lib/kde3/libkatepart.so #13 0x00000000 in ?? () #14 0xbfffd330 in ?? () #15 0xbfffd408 in ?? () #16 0x4000af00 in _dl_runtime_resolve () from /lib/ld-linux.so.2 #17 0x421a62c8 in KateBuffer::openFile () from /opt/kde3/lib/kde3/libkatepart.so
*** Bug 85938 has been marked as a duplicate of this bug. ***