[Kde-games-devel] Review Request: avoid a crash because of a negative area

Jaime Torres Amate jtamate at gmail.com
Sun Dec 16 21:19:11 UTC 2012



> On Dec. 16, 2012, 2:58 p.m., Albert Astals Cid wrote:
> > Waht do you mean R*R and C*C ?
> > 
> > Also this is quite interesting because box2d is used in lots of projects and looking at their upstream code (don't ask me why we have it embedded) it seems the function is still unchanged

R*R is the mathematical infinite plane where all the (real,real) vectors live. In that space, all the mathematical things with dimension between 1 and 2 (including fractals) have area >=0.
C*C is the mathematical infinite plane where all the (complex,complex) vectors live. This space has other properties not found in R*R, including objects with area <0.

This is a strange bug because very few people suffer it, and also because the vectors follow clock hands (siguen el sentido de las manecillas del reloj), as required by box2d. But with the data in the bug report, the area becomes negative, and then the crash.

Also, I remember to have run it under valgrind with no sign of memory overwriten, and with gcc -ftrapv without any overflow or underflow.

Without the patch, I get
kolf: /g/kdegit/kdegames/kolf/external/Box2D/Collision/Shapes/b2PolygonShape.cpp:116: b2Vec2 ComputeCentroid(const b2Vec2*, int32): La declaración `area > b2_floatValues<sizeof(qreal)>::epsilon()' no se cumple.


- Jaime Torres


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107739/#review23537
-----------------------------------------------------------


On Dec. 15, 2012, 6:09 p.m., Jaime Torres Amate wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107739/
> -----------------------------------------------------------
> 
> (Updated Dec. 15, 2012, 6:09 p.m.)
> 
> 
> Review request for KDE Games.
> 
> 
> Description
> -------
> 
> Avoid a crash starting kolf.
> The crash comes when the calculated area is <0, something impossible in R*R (only in C*C).
> The patch makes the area always >=0.
> 
> The patch is similar to what I proposed then, but I forgot how to use reviewboard for svn.
> 
> 
> This addresses bug 258998.
>     http://bugs.kde.org/show_bug.cgi?id=258998
> 
> 
> Diffs
> -----
> 
>   external/Box2D/Collision/Shapes/b2PolygonShape.cpp c96583b 
> 
> Diff: http://git.reviewboard.kde.org/r/107739/diff/
> 
> 
> Testing
> -------
> 
> before, the crash (yes, I still suffer it).
> after, kolf runs.
> 
> 
> Thanks,
> 
> Jaime Torres Amate
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20121216/9615820c/attachment.html>


More information about the kde-games-devel mailing list