This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Another potential null-pointer crash in AuthenticateBase?

Tags: None
(comma "," separated)
jdong
Registered Member
Posts
358
Karma
0
In svn revision 632043, while Martin Pitt was reviewing my patches for a KTorrent crashfix update in Feisty (for 2.1) at https://bugs.launchpad.net/ubuntu/+sour ... bug/110881, he pointed out the following code as suspicious:

Code: Select all
+-            if (ab->isFinished())
++            if (!ab || ab->isFinished())
+             {
+                ab->deleteLater();
+-               std::set<AuthenticateBase*>::iterator j = itr;
+-               itr++;
+-               auths.erase(j);
++               itr = auths.erase(itr);
+             }
+             else


It would seem like if ab was NULL, the if block would still try ab->deleteLater(), which would crash. Is this correct?
George
Moderator
Posts
5421
Karma
1

Fri May 04, 2007 6:05 pm
This code has changed since then, the current code checks for this :

Code: Select all
AuthenticateBase* ab = *itr;
if (!ab || ab->isFinished())
{
   if (ab)
      ab->deleteLater();
            
   itr = auths.erase(itr);
}
else
{
...
jdong
Registered Member
Posts
358
Karma
0

Fri May 04, 2007 6:18 pm
ah, ok, good; do you know which SVN revision that change was made in (is it in the 2.1 branch?)
jdong
Registered Member
Posts
358
Karma
0

Fri May 04, 2007 8:38 pm
Never mind; I found the changeset, tweaked it a bit and am rebuilding to see if it works. Thanks for the help.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot]