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

List:       kde-edu-devel
Subject:    Review Request: Fixing bug 204068, adding ERROR-Token to parser
From:       "Eike Krumbacher" <eike.krumbacher () x-eike ! de>
Date:       2011-11-18 23:26:41
Message-ID: 20111118232641.18681.88083 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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

Review request for KDE Edu.


Description
-------

Hello Folks!

If you have a set of functions like
f(x) = g x ²
g(x) = 2 x

* kmplot crashes without notice, because the parser reads "g" as a function and reports "Wrong \
                number of arguments" but crashes.
* If "g" is meant to be a predefined constant the parser crashes because g is read as a \
function with wrong argument counts. 

So there are several cases:
1) g(x) and f(x) exists in a file, reading the file should not crash
2) if g is a constant, whether in the file or "global", f(x) should read this constant first
3) a function set like 
g(x) = 10 * g
f(x) = g(x) + g
should be read and displayed.

With the given diff, we can archive (1) and (2) but not (3), which now does not crash anymore \
but  gives strange results. In the surrounding of the changes, I added some whitespaces to \
reflect the style guide of the given code. The main part is an introduction of the token \
"ERROR", adding this token to the stack in case of an error. 

Have fun

Eike


This addresses bug 204068.
    http://bugs.kde.org/show_bug.cgi?id=204068


Diffs
-----

  kmplot/parser.h c3fb92e 
  kmplot/parser.cpp 23569aa 

Diff: http://git.reviewboard.kde.org/r/103182/diff/diff


Testing
-------

(1), (2) and (3) was tested. The original file from the bug report associated with this review \
was tested. No crashes in these special cases. 


Thanks,

Eike Krumbacher


[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/103182/">http://git.reviewboard.kde.org/r/103182/</a>
  </td>
    </tr>
   </table>
   <br />


<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 Edu.</div>
<div>By Eike Krumbacher.</div>







<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;">Hello Folks!

If you have a set of functions like
f(x) = g x ²
g(x) = 2 x

* kmplot crashes without notice, because the parser reads &quot;g&quot; as a function and \
                reports &quot;Wrong number of arguments&quot; but crashes.
* If &quot;g&quot; is meant to be a predefined constant the parser crashes because g is read as \
a function with wrong argument counts. 

So there are several cases:
1) g(x) and f(x) exists in a file, reading the file should not crash
2) if g is a constant, whether in the file or &quot;global&quot;, f(x) should read this \
constant first 3) a function set like 
g(x) = 10 * g
f(x) = g(x) + g
should be read and displayed.

With the given diff, we can archive (1) and (2) but not (3), which now does not crash anymore \
but  gives strange results. In the surrounding of the changes, I added some whitespaces to \
reflect the style guide of the given code. The main part is an introduction of the token \
&quot;ERROR&quot;, adding this token to the stack in case of an error. 

Have fun

Eike</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;">(1), (2) and (3) was \
tested. The original file from the bug report associated with this review was tested. No \
crashes in these special cases. </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=204068">204068</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>kmplot/parser.h <span style="color: grey">(c3fb92e)</span></li>

 <li>kmplot/parser.cpp <span style="color: grey">(23569aa)</span></li>

</ul>

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




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




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



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


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

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