Bug 394178 - KWrite crashed when opening a big file
Summary: KWrite crashed when opening a big file
Status: RESOLVED INTENTIONAL
Alias: None
Product: kate
Classification: Applications
Component: kwrite (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2018-05-12 20:44 UTC by Shay G
Modified: 2018-06-06 20:46 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shay G 2018-05-12 20:44:34 UTC
Application: kwrite (18.04.1)

Qt Version: 5.10.1
Frameworks Version: 5.45.0
Operating System: Linux 4.16.8-1-ck-ivybridge x86_64
Distribution: "Arch Linux"

-- Information about the crash:
- What I was doing when the application crashed:
KWrite crashed when opening a big file. I tried to open a 2.6 gb log file and it crashed.

-- Backtrace:
Application: KWrite (kwrite), signal: Aborted
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f81dff40800 (LWP 16544))]

Thread 3 (Thread 0x7f81c1741700 (LWP 16546)):
#0  0x00007f81d520fb49 in g_main_context_prepare () from /usr/lib/libglib-2.0.so.0
#1  0x00007f81d521044e in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007f81d521063e in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007f81dc921254 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#4  0x00007f81dc8c331b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#5  0x00007f81dc6d271e in QThread::exec() () from /usr/lib/libQt5Core.so.5
#6  0x00007f81d7d05416 in ?? () from /usr/lib/libQt5DBus.so.5
#7  0x00007f81dc6d7abd in ?? () from /usr/lib/libQt5Core.so.5
#8  0x00007f81d6fe3075 in start_thread () from /usr/lib/libpthread.so.0
#9  0x00007f81dbfdb53f in clone () from /usr/lib/libc.so.6

Thread 2 (Thread 0x7f81cadca700 (LWP 16545)):
#0  0x00007f81dbfd0ea9 in poll () from /usr/lib/libc.so.6
#1  0x00007f81d32f5180 in ?? () from /usr/lib/libxcb.so.1
#2  0x00007f81d32f6e4b in xcb_wait_for_event () from /usr/lib/libxcb.so.1
#3  0x00007f81cdb7582a in ?? () from /usr/lib/libQt5XcbQpa.so.5
#4  0x00007f81dc6d7abd in ?? () from /usr/lib/libQt5Core.so.5
#5  0x00007f81d6fe3075 in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007f81dbfdb53f in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7f81dff40800 (LWP 16544)):
[KCrash Handler]
#6  0x00007f81dbf1986b in raise () from /usr/lib/libc.so.6
#7  0x00007f81dbf0440e in abort () from /usr/lib/libc.so.6
#8  0x00007f81dc32844a in __gnu_cxx::__verbose_terminate_handler () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#9  0x00007f81dc32e9d6 in __cxxabiv1::__terminate(void (*)()) () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:47
#10 0x00007f81dc32ea13 in std::terminate () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:57
#11 0x00007f81dc32ec48 in __cxxabiv1::__cxa_throw (obj=<optimized out>, tinfo=0x7f81dc619d10 <typeinfo for std::bad_alloc>, dest=0x7f81dc32ce30 <std::bad_alloc::~bad_alloc()>) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:95
#12 0x00007f81dc6bc3d4 in qBadAlloc() () from /usr/lib/libQt5Core.so.5
#13 0x00007f81dc75259b in QString::reallocData(unsigned int, bool) () from /usr/lib/libQt5Core.so.5
#14 0x00007f81dc752d3a in QString::append(QString const&) () from /usr/lib/libQt5Core.so.5
#15 0x00007f81df8bea93 in Kate::TextBuffer::load(QString const&, bool&, bool&, int&, bool) () from /usr/lib/libKF5TextEditor.so.5
#16 0x00007f81df93a25a in KateBuffer::openFile(QString const&, bool) () from /usr/lib/libKF5TextEditor.so.5
#17 0x00007f81df932bb9 in KTextEditor::DocumentPrivate::openFile() () from /usr/lib/libKF5TextEditor.so.5
#18 0x00007f81df1976c8 in ?? () from /usr/lib/libKF5Parts.so.5
#19 0x00007f81df1985ab in KParts::ReadOnlyPart::openUrl(QUrl const&) () from /usr/lib/libKF5Parts.so.5
#20 0x00007f81df91f0c2 in KTextEditor::DocumentPrivate::openUrl(QUrl const&) () from /usr/lib/libKF5TextEditor.so.5
#21 0x0000557717de22ca in ?? ()
#22 0x0000557717de047c in main ()

Possible duplicates by query: bug 389500, bug 382439.

Reported using DrKonqi
Comment 1 Christoph Feck 2018-06-06 20:46:55 UTC
QString failed to allocate the number of bytes requested. It stores 2 bytes for each character, because it internally uses UTF-16 coding units. With more than 1,000,000,000 characters it needs more than 2 GB. QString doesn't handle this, and porting away from QString would require a complete rewrite of the code.