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

List:       kde-core-devel
Subject:    Re: Review Request: Avoid possible null pointer dereferences in khtml
From:       "Jaime Torres Amate" <jtamate () gmail ! com>
Date:       2011-10-07 16:25:51
Message-ID: 20111007162551.21505.46026 () vidsolbach ! de
[Download RAW message or body]

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

(Updated Oct. 7, 2011, 4:25 p.m.)


Review request for kdelibs.


Changes
-------

Removed the trailing whitespace changes (I've always been asked to remove then before \
commiting). Using a local ret variable and only one return.
If there is a isNotEmpty method, then I'll change !isEmpty() with it, otherwise I'll \
leave it untouched. 

boolean disertation:
I agree with Christoph and Dijkstra. 
!isEmpty() is read as "not is empty?" or as "is not empty?" and isEmpty()==false is \
read as "is empty false?" .Which one is easier? Please, do not answer. In python it \
is  if not isEmpty():  or if isEmpty()==False:


Description
-------

The real changes are:
Avoid possible null pointer dereferences in khtml.
The common check
  if (a && something(a)) do return bla(a) else blabla(a)       uses blabla(a) with \
null a. changed to  if (a) { if something(a)) do return bla(a) else blabla(a) }

As a side effect:
kate has removed a lot of tailing spaces in the edited files.
Avoid a possible crash checking the index limit before accesing the array.
Move some variables inside the #ifdef block where they are used


Diffs (updated)
-----

  khtml/css/css_valueimpl.cpp 3fb2898 
  khtml/ecma/kjs_window.cpp 0e7394b 
  khtml/html/htmltokenizer.cpp b64e83d 
  khtml/java/kjavaappletserver.cpp 234c6f3 
  khtml/khtml_part.cpp 53929fa 
  khtml/khtmlimage.cpp c6e6366 
  khtml/khtmlview.cpp 28dbac3 
  khtml/rendering/render_form.cpp c15247a 
  khtml/rendering/render_table.cpp 5b07714 
  khtml/xpath/util.cpp 079008d 

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


Testing
-------

no regressions in kdelibs tests.


Thanks,

Jaime Torres Amate


[Attachment #3 (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/102794/">http://git.reviewboard.kde.org/r/102794/</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 kdelibs.</div>
<div>By Jaime Torres Amate.</div>


<p style="color: grey;"><i>Updated Oct. 7, 2011, 4:25 p.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</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;">Removed the trailing whitespace changes (I&#39;ve always been asked to \
remove then before commiting). Using a local ret variable and only one return.
If there is a isNotEmpty method, then I&#39;ll change !isEmpty() with it, otherwise \
I&#39;ll leave it untouched. 

boolean disertation:
I agree with Christoph and Dijkstra. 
!isEmpty() is read as &quot;not is empty?&quot; or as &quot;is not empty?&quot; and \
isEmpty()==false is read as &quot;is empty false?&quot; .Which one is easier? Please, \
do not answer. In python it is  if not isEmpty():  or if isEmpty()==False:</pre>
  </td>
 </tr>
</table>




<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;">The real changes are: Avoid possible null pointer dereferences in khtml.
The common check
  if (a &amp;&amp; something(a)) do return bla(a) else blabla(a)       uses blabla(a) \
with null a. changed to  if (a) { if something(a)) do return bla(a) else blabla(a) }

As a side effect:
kate has removed a lot of tailing spaces in the edited files.
Avoid a possible crash checking the index limit before accesing the array.
Move some variables inside the #ifdef block where they are used

</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;">no regressions in kdelibs tests.</pre>  </td>
 </tr>
</table>




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

 <li>khtml/css/css_valueimpl.cpp <span style="color: grey">(3fb2898)</span></li>

 <li>khtml/ecma/kjs_window.cpp <span style="color: grey">(0e7394b)</span></li>

 <li>khtml/html/htmltokenizer.cpp <span style="color: grey">(b64e83d)</span></li>

 <li>khtml/java/kjavaappletserver.cpp <span style="color: grey">(234c6f3)</span></li>

 <li>khtml/khtml_part.cpp <span style="color: grey">(53929fa)</span></li>

 <li>khtml/khtmlimage.cpp <span style="color: grey">(c6e6366)</span></li>

 <li>khtml/khtmlview.cpp <span style="color: grey">(28dbac3)</span></li>

 <li>khtml/rendering/render_form.cpp <span style="color: grey">(c15247a)</span></li>

 <li>khtml/rendering/render_table.cpp <span style="color: grey">(5b07714)</span></li>

 <li>khtml/xpath/util.cpp <span style="color: grey">(079008d)</span></li>

</ul>

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




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




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



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

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