Bug 51720

Summary: directory listing for webdav is broken
Product: [Applications] konqueror Reporter: Eugene Onischenko <oneugene>
Component: generalAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: 51720.patch

Description Eugene Onischenko 2002-12-10 14:31:36 UTC
Version:           3.1.0 (using KDE 3.1.0 (RC5))
Installed from:    compiled sources
Compiler:          gcc version 2.96 20000731 (Mandrake Linux 8.1 2.96-0.63.1mdk)
OS:          Linux (i686) release 2.4.19-xfs

I've entered webdav address into konquerror's location field (webdav://localhost/) and pressed enter.

After that konquerror waits for something (i.e. animated log rotates but nothing happens).

When i'm trying to load the same URL again the konquerror crashes:

[New Thread 1024 (LWP 29812)]
0x411614f9 in wait4 () from /lib/libc.so.6
#0  0x411614f9 in wait4 () from /lib/libc.so.6
#1  0x411df0b8 in __check_rhosts_file () from /lib/libc.so.6
#2  0x4100f986 in waitpid (pid=30171, stat_loc=0x0, options=0)
    at wrapsyscall.c:172
#3  0x4057466d in KCrash::defaultCrashHandler ()
   from /home/eugene/donotbackup/kde/binary/kde-3.1/lib/libkdecore.so.4
#4  0x4100d30b in pthread_sighandler (signo=11, ctx=
      {gs = 0, __gsh = 0, fs = 0, __fsh = 0, es = 43, __esh = 0, ds = 43, __dsh = 0, edi = 3221216704, esi = 136841256, ebp = 3221216664, esp = 3221215824, ebx = 1094572236, edx = 136921840, ecx = 136841576, eax = 2097266, trapno = 14, err = 4, eip = 1094215900, cs = 35, __csh = 0, eflags = 66054, esp_at_signal = 3221215824, ss = 43, __ssh = 0, fpstate = 0xbfffd7d0, oldmask = 2147483648, cr2 = 2097298}) at signals.c:97
#5  0x410d47c8 in killpg () from /lib/libc.so.6
#6  0x41385c6c in KonqMainWindow::openFilteredURL ()
   from /home/eugene/donotbackup/kde/binary/kde-3.1/lib/konqueror.so
#7  0x4138f436 in KonqMainWindow::slotURLEntered ()
   from /home/eugene/donotbackup/kde/binary/kde-3.1/lib/konqueror.so
#8  0x4139ebb9 in KonqMainWindow::qt_invoke ()
   from /home/eugene/donotbackup/kde/binary/kde-3.1/lib/konqueror.so
#9  0x409521c0 in QObject::activate_signal ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#10 0x413bef98 in KonqCombo::activated ()
   from /home/eugene/donotbackup/kde/binary/kde-3.1/lib/konqueror.so
#11 0x413bdc4c in KonqCombo::eventFilter ()
   from /home/eugene/donotbackup/kde/binary/kde-3.1/lib/konqueror.so
#12 0x4094f86b in QObject::activate_filters ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#13 0x4094f731 in QObject::event ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#14 0x4098c604 in QWidget::event ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#15 0x40a0dd81 in QLineEdit::event ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#16 0x408f2bbd in QApplication::internalNotify ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#17 0x408f22ef in QApplication::notify ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#18 0x4050fcec in KApplication::notify ()
   from /home/eugene/donotbackup/kde/binary/kde-3.1/lib/libkdecore.so.4
#19 0x4089c399 in QETWidget::translateKeyEvent ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#20 0x408980b7 in QApplication::x11ProcessEvent ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#21 0x408ab020 in QEventLoop::processEvents ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#22 0x40906a4f in QEventLoop::enterLoop ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#23 0x40906995 in QEventLoop::exec ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#24 0x408f2db2 in QApplication::exec ()
   from /home/eugene/donotbackup/kde/binary/qt-3.1/lib/libqt-mt.so.3
#25 0x41382af3 in main ()
   from /home/eugene/donotbackup/kde/binary/kde-3.1/lib/konqueror.so
#26 0x0804cb7b in launch ()
#27 0x0804d847 in handle_launcher_request ()
#28 0x0804dc75 in handle_requests ()
#29 0x0804eb55 in main ()
#30 0x410c25b0 in __libc_start_main () from /lib/libc.so.6
Comment 1 Eugene Onischenko 2002-12-10 22:01:50 UTC
Here is another backtrace from libraries with debug info 
 
[New Thread 1024 (LWP 635)] 
0x41041609 in wait4 () from /lib/libc.so.6 
#0  0x41041609 in wait4 () from /lib/libc.so.6 
#1  0x410b6dd0 in __check_rhosts_file () from /lib/libc.so.6 
#2  0x40eaeeeb in waitpid () from /lib/libpthread.so.0 
#3  0x4069113c in KCrash::defaultCrashHandler(int) (sig=6) 
    at /home/kde/src/kde/kdelibs/kdecore/kcrash.cpp:235 
#4  0x40eaca44 in pthread_sighandler () from /lib/libpthread.so.0 
#5  0x40fca518 in sigaction () from /lib/libc.so.6 
#6  0x40eace29 in raise () from /lib/libpthread.so.0 
#7  0x40fcb8d1 in abort () from /lib/libc.so.6 
#8  0x40fc4db2 in __assert_fail () from /lib/libc.so.6 
#9  0x4020567a in KRun::slotStatResult(KIO::Job*) () 
    at /home/kde/src/kde/kdelibs/kdecore/kdebug.h:178 
#10 0x4004bbd7 in KParts::BrowserRun::slotStatResult(KIO::Job*) ( 
    this=0x8245c48, job=0x82464d0) 
    at /home/kde/src/kde/kdelibs/kparts/browserrun.cpp:303 
#11 0x4004bf93 in KParts::BrowserRun::qt_invoke(int, QUObject*) ( 
    this=0x8245c48, _id=9, _o=0xbfffe840) 
    at /home/kde/binary/qt-3.1/include/private/qucom_p.h:312 
#12 0x412ee3fd in KonqRun::qt_invoke(int, QUObject*) (this=0x8245c48,  
    _id=-1073747904, _o=0x8245c48) at konq_run.moc:89 
#13 0x409e8376 in QObject::activate_signal(QConnectionList*, 
QUObject*) () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#14 0x4016b362 in KIO::Job::result(KIO::Job*) (this=0x82464d0, 
t0=0xfffffe00) 
    at jobclasses.moc:157 
#15 0x40153a2a in KIO::Job::emitResult() (this=0x82464d0) 
    at /home/kde/src/kde/kdelibs/kio/kio/job.cpp:183 
#16 0x4015573e in KIO::SimpleJob::slotFinished() (this=0x82464d0) 
    at /home/kde/src/kde/kdelibs/kio/kio/job.cpp:501 
#17 0x40157392 in KIO::StatJob::slotFinished() (this=0x82464d0) 
    at /home/kde/src/kde/kdelibs/kio/kio/job.cpp:678 
#18 0x4016c3b8 in KIO::StatJob::qt_invoke(int, QUObject*) 
(this=0x82464d0,  
    _id=18, _o=0xbfffeb20) at jobclasses.moc:555 
#19 0x409e8376 in QObject::activate_signal(QConnectionList*, 
QUObject*) () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#20 0x409e8233 in QObject::activate_signal(int) () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#21 0x4014694e in KIO::SlaveInterface::finished() (this=0xfffffe00) 
    at /home/kde/binary/qt-3.1/include/qmetaobject.h:261 
#22 0x40143e17 in KIO::SlaveInterface::dispatch(int, QMemArray<char> 
const&) ( 
    this=0x8246038, _cmd=104, rawdata=@0x8246038) 
    at /home/kde/src/kde/kdelibs/kio/kio/slaveinterface.cpp:256 
#23 0x40143110 in KIO::SlaveInterface::dispatch() (this=0x8246038) 
    at /home/kde/src/kde/kdelibs/kio/kio/slaveinterface.cpp:192 
#24 0x4013ff18 in KIO::Slave::gotInput() (this=0x40052dd8) 
    at /home/kde/src/kde/kdelibs/kio/kio/slave.cpp:221 
#25 0x401425d0 in KIO::Slave::qt_invoke(int, QUObject*) 
(this=0x8246038,  
    _id=4, _o=0xbfffef20) at slave.moc:114 
#26 0x409e8376 in QObject::activate_signal(QConnectionList*, 
QUObject*) () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#27 0x409e8427 in QObject::activate_signal(int, int) () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#28 0x40c71cad in QSocketNotifier::activated(int) () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#29 0x40a006a0 in QSocketNotifier::event(QEvent*) () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#30 0x409942a5 in QApplication::internalNotify(QObject*, QEvent*) () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#31 0x40993b40 in QApplication::notify(QObject*, QEvent*) () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#32 0x406032f9 in KApplication::notify(QObject*, QEvent*) (this=0x0,  
    receiver=0x8245e00, event=0xbffff1d0) 
    at /home/kde/src/kde/kdelibs/kdecore/kapplication.cpp:453 
#33 0x4097310c in QEventLoop::activateSocketNotifiers() () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#34 0x40954981 in QEventLoop::processEvents(unsigned) () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#35 0x409a5883 in QEventLoop::enterLoop() () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#36 0x409a5740 in QEventLoop::exec() () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#37 0x409944b8 in QApplication::exec() () 
   from /home/kde/binary/qt-3.1/lib/libqt-mt.so.3 
#38 0x412b7aa7 in main (argc=0, argv=0x0) 
    at /home/kde/src/kde/kdebase/konqueror/konq_main.cc:130 
#39 0x0804cbd6 in launch (argc=2, _name=0x805d67c "konqueror",  
    args=0x805d68f "\001", cwd=0x0, envc=1, envs=0x805d686 "--silent",  
    reset_env=false, tty=0x0, avoid_loops=false, startup_id_str=0x0) 
    at /home/kde/src/kde/kdelibs/kinit/kinit.cpp:547 
Comment 2 Eugene Onischenko 2002-12-17 08:44:27 UTC
Subject: I think i've foud the solution

Hi,

I think it is not a kde bug. It appears that
QString & QString::operator+= ( const QByteArray & str ) is broken.
The operator appends more than QByteArray::size() bytes (it appends chars till 
'\0' is not found like null terminated strings).

I've made a small patch for http/webdav io slave (see attached file).



Created an attachment (id=627)
51720.patch
Comment 3 Mahnu Promayon 2003-02-12 19:58:45 UTC
I had the same problem here (KDE3.1 compiled source).  
Used the patch, works now perfectly.  
Isn't it strange this patch did not make it befor the final 3.1 release?  
(not sure that's the right place to put a comment, and am not sure someone will see  
that to integrate it in the 3.1.1 release)  
 
When is a bug closed? 
  
Thanks for the webdav client anyway (and thanks for the patch)  
Life is so easier with the tools you are developping!  
Comment 4 George Staikos 2003-02-12 23:26:17 UTC
Subject: KDE_3_1_BRANCH: kdelibs/kioslave/http

CVS commit by staikos: 

Apply Eugene's patch

CCMAIL: 51720-done@bugs.kde.org


  M +6 -0      http.cc   1.551.2.7


--- kdelibs/kioslave/http/http.cc  #1.551.2.6:1.551.2.7
@@ -3813,4 +3813,10 @@ void HTTPProtocol::slotData(const QByteA
    else
    {
+      // bugfix from Eugene Onischenko - #51720 - Make sure that the buffer
+      // is null terminated when we append to a string since Qt doesn't look
+      // at m_bufReceive.size() in QString::operator+=(const QByteArray&)
+                // I'm not sure if this is always very efficient unfortunately.
+      m_bufReceive.resize(m_bufReceive.size()+1);
+      m_bufReceive.data()[m_bufReceive.size()-1] = 0;
       m_intData += m_bufReceive;
    }