[Kde-games-devel] Review Request 126919: Fix crash when placing bonuses in the arena

Mathias Kraus k.hias at gmx.de
Fri Jan 29 19:29:00 UTC 2016


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


Ship it!




Ship It!

- Mathias Kraus


On Jan. 28, 2016, 1:30 p.m., Julian Helfferich wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/126919/
> -----------------------------------------------------------
> 
> (Updated Jan. 28, 2016, 1:30 p.m.)
> 
> 
> Review request for KDE Games.
> 
> 
> Repository: granatier
> 
> 
> Description
> -------
> 
> The crash takes place in game.cpp - Game::createBonus(). The total amount of blocks is nFullSize. To place the bonuses, the game iterates over 4 quarters, the first three containing nFullSize/4 blocks and the last containing the remaining blocks. Thus, nQuarterSize can be larger for the last quarter than for the previous three. Now, when a bonus is assigned to a block, the index of the block is calculated as
> 
> nIndex = nQuarter * nQuarterSize + i
> 
> where i iterates from zero to nQuarterSize. The idea is that nQuarter * nQuarterSize is the number of blocks of the previous quarters. However, since nQuarterSize can be larger for the last quarter, this can lead to an index out of bounds when a bonus is to be placed in one of the last blocks. The fixed version is
> 
> nIndex = nQuarter * (nFullSize/4) + i
> 
> where nFullSize/4 is the size of the first three quarters.
> 
> 
> Diffs
> -----
> 
>   src/game.cpp 371fac9 
> 
> Diff: https://git.reviewboard.kde.org/r/126919/diff/
> 
> 
> Testing
> -------
> 
> Started the game a lot of times. Crash did not happen.
> 
> 
> Thanks,
> 
> Julian Helfferich
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20160129/9714e7a8/attachment.html>


More information about the kde-games-devel mailing list