Bug 134079 - KTorrent crashes when merging dht torrents
Summary: KTorrent crashes when merging dht torrents
Status: RESOLVED FIXED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-14 18:32 UTC by Clara Gnos
Modified: 2006-09-15 18:00 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Clara Gnos 2006-09-14 18:32:37 UTC
Version:           SVN 584384 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc-Version 4.1.1 (Gentoo 4.1.1-r1) 
OS:                Linux

It crashes when I have opened a dht only torrent and then opening the same torrent again. When it wants to merge the tracker urls it will crash because of a null pointer exception:

Tested with the torrent from bug 134054

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1210452304 (LWP 23213)]
0xb7f06a98 in kt::TrackersList::merge (this=0x832de00, al=0x0) at trackerslist.cpp:36
36                      KURL::List urls = al->getTrackerURLs();
(gdb) bt
#0  0xb7f06a98 in kt::TrackersList::merge (this=0x832de00, al=0x0) at trackerslist.cpp:36
#1  0xb7ecdcd1 in bt::QueueManager::mergeAnnounceList (this=0x82c8700, ih=@0x854a8c4, al=0x0) at queuemanager.cpp:281
#2  0xb7e9786f in bt::TorrentControl::checkExisting (this=0x8556138, qman=0x82c8700) at torrentcontrol.cpp:486
#3  0xb7e97c02 in bt::TorrentControl::initInternal (this=0x8556138, qman=0x82c8700, tmpdir=@0xbffe07ec, ddir=@0xbffe0838,
    default_save_dir=@0xbffe07f0, first_time=true) at torrentcontrol.cpp:586
#4  0xb7e9821a in bt::TorrentControl::init (this=0x8556138, qman=0x82c8700, data=@0xbffe0844, tmpdir=@0xbffe07ec, ddir=@0xbffe0838,
    default_save_dir=@0xbffe07f0) at torrentcontrol.cpp:467
#5  0x0807e73f in KTorrentCore::load (this=0x82cc318, data=@0xbffe0844, dir=@0xbffe0838, silently=false) at ktorrentcore.cpp:169
#6  0x0807ece4 in KTorrentCore::downloadFinished (this=0x82cc318, job=0x855be88) at ktorrentcore.cpp:238
#7  0x0807f1a8 in KTorrentCore::qt_invoke (this=0x82cc318, _id=14, _o=0xbffe0904) at ktorrentcore.moc:274
#8  0x4fa048c9 in QObject::activate_signal () from /usr/qt/3/lib/libqt-mt.so.3
#9  0x414d7374 in KIO::Job::result () from /usr/kde/3.5/lib/libkio.so.4
#10 0x0855be88 in ?? ()
#11 0x085409f8 in ?? ()
#12 0xbffe0904 in ?? ()
#13 0x4f5db141 in operator delete () from /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/libstdc++.so.6
#14 0x0855be88 in ?? ()
#15 0x084c05bc in ?? ()
#16 0x0000000b in ?? ()
Previous frame inner to this frame (corrupt stack?)
Comment 1 Joris Guisson 2006-09-15 18:00:25 UTC
SVN commit 584817 by guisson:

Fixed crash when merging announce lists of torrents

BUG: 134079



 M  +2 -3      interfaces/trackerslist.cpp  
 M  +1 -1      interfaces/trackerslist.h  
 M  +1 -0      torrent/peersourcemanager.h  
 M  +2 -2      torrent/queuemanager.cpp  
 M  +2 -2      torrent/queuemanager.h  
 M  +1 -1      torrent/torrentcontrol.cpp  


--- trunk/extragear/network/ktorrent/libktorrent/interfaces/trackerslist.cpp #584816:584817
@@ -31,10 +31,9 @@
 	{
 	}
 	
-	void TrackersList::merge(TrackersList* al)
+	void TrackersList::merge(const KURL::List & urls)
 	{
-		KURL::List urls = al->getTrackerURLs();
-		KURL::List::iterator i = urls.begin();
+		KURL::List::const_iterator i = urls.begin();
 		while (i != urls.end())
 		{
 			addTracker(*i,true);
--- trunk/extragear/network/ktorrent/libktorrent/interfaces/trackerslist.h #584816:584817
@@ -72,7 +72,7 @@
 			 * Merge an other tracker list.
 			 * @param al The TrackersList
 			 */
-			void merge(TrackersList* al);
+			void merge(const KURL::List & ul);
 
 	};
 
--- trunk/extragear/network/ktorrent/libktorrent/torrent/peersourcemanager.h #584816:584817
@@ -62,6 +62,7 @@
 	public:
 		PeerSourceManager(TorrentControl* tor,PeerManager* pman);
 		virtual ~PeerSourceManager();
+	
 				
 		/**
 		 * Add a PeerSource, the difference between PeerSource and Tracker
--- trunk/extragear/network/ktorrent/libktorrent/torrent/queuemanager.cpp #584816:584817
@@ -269,7 +269,7 @@
 		return false;
 	}
 	
-	void QueueManager::mergeAnnounceList(const SHA1Hash & ih,kt::TrackersList* al)
+	void QueueManager::mergeAnnounceList(const SHA1Hash & ih,const KURL::List & urls)
 	{
 		QPtrList<kt::TorrentInterface>::iterator itr = downloads.begin();
 		while (itr != downloads.end())
@@ -278,7 +278,7 @@
 			if (tor->getTorrent().getInfoHash() == ih)
 			{
 				TrackersList* ta = tor->getTrackersList(); 
-				ta->merge(al);
+				ta->merge(urls);
 				return;
 			}
 			itr++;
--- trunk/extragear/network/ktorrent/libktorrent/torrent/queuemanager.h #584816:584817
@@ -95,9 +95,9 @@
 			/**
 			 * Merge announce lists to a torrent
 			 * @param ih The info_hash of the torrent to merge to
-			 * @param al The TrackersList
+			 * @param urls List of urls
 			 */
-			void mergeAnnounceList(const SHA1Hash & ih,kt::TrackersList* al);
+			void mergeAnnounceList(const SHA1Hash & ih,const KURL::List & urls);
 			
 			void setMaxDownloads(int m);
 			void setMaxSeeds(int m);
--- trunk/extragear/network/ktorrent/libktorrent/torrent/torrentcontrol.cpp #584816:584817
@@ -483,7 +483,7 @@
 		{
 			if (!stats.priv_torrent)
 			{
-				qman->mergeAnnounceList(tor->getInfoHash(),psman);
+				qman->mergeAnnounceList(tor->getInfoHash(),tor->getTrackerList());
 
 				throw Error(i18n("You are already downloading this torrent %1, the list of trackers of both torrents has been merged.").arg(tor->getNameSuggestion()));
 			}