[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-games-devel
Subject:    Re: [Kde-games-devel] Review Request: avoid a crash because of a negative area
From:       "Jaime Torres Amate" <jtamate () gmail ! com>
Date:       2012-12-16 21:19:11
Message-ID: 20121216211911.26716.29908 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> 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
> 
> 


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/107739/">http://git.reviewboard.kde.org/r/107739/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On December 16th, 2012, 2:58 p.m., <b>Albert \
Astals Cid</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px \
solid #d0d0d0; padding-left: 10px;">  <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">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&#39;t ask me why we have it embedded) it seems the \
function is still unchanged</pre>  </blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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 \
&gt;=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 &lt;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 &gt; \
b2_floatValues&lt;sizeof(qreal)&gt;::epsilon()&#39; no se cumple. </pre>
<br />








<p>- Jaime Torres</p>


<br />
<p>On December 15th, 2012, 6:09 p.m., Jaime Torres Amate wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for KDE Games.</div>
<div>By Jaime Torres Amate.</div>


<p style="color: grey;"><i>Updated Dec. 15, 2012, 6:09 p.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Avoid a crash starting kolf. The crash comes when the calculated area is \
&lt;0, something impossible in R*R (only in C*C). The patch makes the area always \
&gt;=0.

The patch is similar to what I proposed then, but I forgot how to use reviewboard for \
svn.</pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">before, the crash (yes, I still suffer it). after, kolf runs.</pre>
  </td>
 </tr>
</table>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="http://bugs.kde.org/show_bug.cgi?id=258998">258998</a>


</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>external/Box2D/Collision/Shapes/b2PolygonShape.cpp <span style="color: \
grey">(c96583b)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/107739/diff/" style="margin-left: \
3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
kde-games-devel mailing list
kde-games-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-games-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic