Review Request 127958: Fix Coverty Scan ID 1342042 - Explicit null dereferenced

Hartmut Riesenbeck hartmut.riesenbeck at gmx.de
Thu May 19 20:16:24 UTC 2016



> On Mai 18, 2016, 11:02 nachm., Aleix Pol Gonzalez wrote:
> > src/settings/kgametheme/kgamethemeselector.cpp, line 194
> > <https://git.reviewboard.kde.org/r/127958/diff/1/?file=465140#file465140line194>
> >
> >     I'd say doing `!currentItem` is perfectly fine, if not preferred.
> >     
> >     In fact, it looks to me like the logic is being changed. Can you please make sure?

May I misunderstood the root issue which was shown up by the coverty scan.

For me the problematic part is not the currentItem pointer but the result of the themeMap.value() call, which is used two times in this method. QMap::value() returns here a null pointer if the requested value is not in the map. This leads to a nullptr->text() call. I changed my patch to (hopefully) more straight forward code.


- Hartmut


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127958/#review95598
-----------------------------------------------------------


On Mai 18, 2016, 7:52 nachm., Hartmut Riesenbeck wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127958/
> -----------------------------------------------------------
> 
> (Updated Mai 18, 2016, 7:52 nachm.)
> 
> 
> Review request for KDE Edu.
> 
> 
> Repository: parley
> 
> 
> Description
> -------
> 
> KGameThemeSelectorPrivate::_k_updateThemeList() was made more robust to
> prevent null pointer access when an entry in themeMap was not found.
> For this case the value() method returns a null pointer which was not
> checked before refactoring.
> 
> 
> Diffs
> -----
> 
>   src/settings/kgametheme/kgamethemeselector.cpp dc896d5792e6090f63dfb54c6c377e5971f41aeb 
> 
> Diff: https://git.reviewboard.kde.org/r/127958/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Hartmut Riesenbeck
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20160519/71215419/attachment.html>


More information about the kde-edu mailing list