[digikam] [Bug 372872] New: Possible Null-Pointer dereference in AlbumManager [patch]

Mario Frank bugzilla_noreply at kde.org
Thu Nov 24 07:34:50 GMT 2016


            Bug ID: 372872
           Summary: Possible Null-Pointer dereference in AlbumManager
           Product: digikam
           Version: 5.4.0
          Platform: Compiled Sources
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: Searches-Fuzzy
          Assignee: digikam-devel at kde.org
          Reporter: mario.frank at uni-potsdam.de
  Target Milestone: ---

Created attachment 102429
  --> https://bugs.kde.org/attachment.cgi?id=102429&action=edit
Patch for the possible NULL Pointer derefernce

As reported by coverty scan:
*** CID 1394671:  Null pointer dereferences  (FORWARD_NULL)
/home/gilles/Devel/5.x/core/libs/album/albummanager.cpp: 2080 in
Digikam::AlbumManager::findSAlbumsBySearchType(int) const()
2075     QList<SAlbum*> AlbumManager::findSAlbumsBySearchType(int searchType)
2076     {
2077         QList<SAlbum*> albums;
2078         for (Album* album = d->rootSAlbum->firstChild(); album; album =
2079         {
>>>     CID 1394671:  Null pointer dereferences  (FORWARD_NULL)
>>>     Assigning: "sAlbum" = "dynamic_cast <Digikam::SAlbum *>(album)".
2080             SAlbum* sAlbum = dynamic_cast<SAlbum*>(album);
2081             if (sAlbum->searchType() == searchType)
2082             {
2083                 albums.append(sAlbum);
2084             }
2085         }

As I understand that, either firstChild() may return NULL which is processed by
dynamic_cast and this may also return NULL.
I prevent that by explicitly checking for NULL.

You are receiving this mail because:
You are the assignee for the bug.

More information about the Digikam-devel mailing list