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

List:       kde-i18n-doc
Subject:    Re: Review Request 127834: ki18n: Fix theoretically possible use-after-free in gettext when using st
From:       Michael Pyne <mpyne () kde ! org>
Date:       2016-05-07 22:17:23
Message-ID: 20160507221723.17376.64034 () mimi ! kde ! org
[Download RAW message or body]

--===============9198364755008863855==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit



> On May 7, 2016, 12:26 p.m., Christoph Feck wrote:
> > This commit causes compilation failure:
> > 
> > ki18n/src/gettext.h:130:9: error: 'translation_found' was not declared in this scope
> > ki18n/src/gettext.h:180:9: error: 'translation_found' was not declared in this scope
> 
> Chusslove Illich wrote:
> Moved the declaration now outside of #ifdef block, should work for you.

Sorry about that, I did forget to re-compile after removing my 'force VLA support disabled' \
local hack. Mea culpa!


- Michael


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


On May 7, 2016, 4:12 a.m., Michael Pyne wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127834/
> -----------------------------------------------------------
> 
> (Updated May 7, 2016, 4:12 a.m.)
> 
> 
> Review request for KDE Frameworks, Localization and Translation (l10n) and Chusslove Illich.
> 
> 
> Repository: ki18n
> 
> 
> Description
> -------
> 
> Coverity noted that some of code for message catalog lookup uses some pointer values after \
> they are freed. Even though the use in question is a simple equality comparison against a \
> different (valid) pointer, it is still undefined behavior according to the C (and C++) \
> language specs and is therefore liable to cause miscompilation and who knows what other kinds \
> of problems. 
> This code is not normally enabled, normally a code path that supports variable-length arrays \
> is active, which is not susceptible to this bug. 
> Since VLAs are not supported even in current C++ versions, making VLA support mandatory is \
> not feasible, so instead I opted to move the pointer comparisons to a point in the code where \
> the comparison is valid, and then use the saved result later. 
> I have also reported the bug to GNU Gettext, since upstream still has the error. It is GNU \
> Gettext bug 47847. 
> 
> Diffs
> -----
> 
> src/gettext.h b06fc90 
> 
> Diff: https://git.reviewboard.kde.org/r/127834/diff/
> 
> 
> Testing
> -------
> 
> Code compiles and KDE applications still seem to work fine. I also tested with the changed \
> code path forcibly enabled by disabling VLA support, and things still seemed to work. 
> There's not a lot of autotests to choose from, but the KLocalizedString test still passed.
> 
> 
> Thanks,
> 
> Michael Pyne
> 
> 


--===============9198364755008863855==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit




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





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On May 7th, 2016, 12:26 p.m. UTC, <b>Christoph Feck</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;">This commit causes compilation failure:

ki18n/src/gettext.h:130:9: error: &#39;translation_found&#39; was not declared in this scope
ki18n/src/gettext.h:180:9: error: &#39;translation_found&#39; was not declared in this \
scope</pre>  </blockquote>




 <p>On May 7th, 2016, 12:39 p.m. UTC, <b>Chusslove Illich</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;">Moved the declaration now outside of #ifdef \
block, should work for you.</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;">Sorry about that, I did forget to re-compile \
after removing my &#39;force VLA support disabled&#39; local hack. Mea culpa!</pre> <br />










<p>- Michael</p>


<br />
<p>On May 7th, 2016, 4:12 a.m. UTC, Michael Pyne wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px \
#888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">  <tr>
  <td>

<div>Review request for KDE Frameworks, Localization and Translation (l10n) and Chusslove \
Illich.</div> <div>By Michael Pyne.</div>


<p style="color: grey;"><i>Updated May 7, 2016, 4:12 a.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
ki18n
</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;">Coverity noted that \
some of code for message catalog lookup uses some pointer values after they are freed. Even \
though the use in question is a simple equality comparison against a different (valid) pointer, \
it is still undefined behavior according to the C (and C++) language specs and is therefore \
liable to cause miscompilation and who knows what other kinds of problems.

This code is not normally enabled, normally a code path that supports variable-length arrays is \
active, which is not susceptible to this bug.

Since VLAs are not supported even in current C++ versions, making VLA support mandatory is not \
feasible, so instead I opted to move the pointer comparisons to a point in the code where the \
comparison is valid, and then use the saved result later.

I have also reported the bug to GNU Gettext, since upstream still has the error. It is GNU \
Gettext bug 47847.</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;">Code compiles and KDE \
applications still seem to work fine. I also tested with the changed code path forcibly enabled \
by disabling VLA support, and things still seemed to work.

There&#39;s not a lot of autotests to choose from, but the KLocalizedString test still \
passed.</pre>  </td>
 </tr>
</table>


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

 <li>src/gettext.h <span style="color: grey">(b06fc90)</span></li>

</ul>

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






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







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


--===============9198364755008863855==--


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

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