<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>






<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; border-collapse: separate; border-spacing: 0; margin: 0 auto;">
<tbody>
<tr>
<td style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; overflow: hidden;" align="left" bgcolor="#ffffff">
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; border-collapse: separate; border-spacing: 0;">
<tbody>
<tr>
<td style="color: #333333; border-bottom-width: 1px; border-bottom-color: #ededed; border-bottom-style: solid; font-size: 15px; font-weight: bold; line-height: 1.4; padding: 20px 0;">
Merge request <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1392">!1392</a> was reviewed by <a href="https://gitlab.com/ep69">Stanislav Židek</a>
</td>
</tr>
<tr>
<td style="overflow: hidden; font-size: 14px; line-height: 1.4; display: grid;">
<p style="color: #777777;">
<a href="https://gitlab.com/ep69">Stanislav Židek</a>
started a new
discussion on <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1392#note_516422512">lib/x509/crl.c</a>:
</p>
<table>
<tr class="line_holder old" id="">
<td class="old_line diff-line-num old" data-linenumber="1276" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
1276
</td>
<td class="new_line diff-line-num old" data-linenumber="1275" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#fbe9eb">
<pre style="margin: 0;">-<span id="LC1276" class="line" lang="c">               <span class="n" style="color: #333;">gnutls_realloc_fast</span><span class="p">(</span><span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">crls</span><span class="p">,</span></span>
</pre>
</td>
</tr>
<tr class="line_holder old" id="">
<td class="old_line diff-line-num old" data-linenumber="1277" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
1277
</td>
<td class="new_line diff-line-num old" data-linenumber="1275" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#fbe9eb">
<pre style="margin: 0;">-<span id="LC1277" class="line" lang="c">                                   <span class="k" style="font-weight: 600;">sizeof</span><span class="p">(</span><span class="n" style="color: #333;">gnutls_x509_crl_t</span><span class="p">)</span> <span class="o" style="font-weight: 600;">*</span> <span class="n" style="color: #333;">init</span><span class="p">);</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="old_line diff-line-num new" data-linenumber="1278" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="1275" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
1275
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC1275" class="line" lang="c">           <span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">crls</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333;">_gnutls_reallocarray_fast</span><span class="p">(</span><span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">crls</span><span class="p">,</span> <span class="n" style="color: #333;">init</span><span class="p">,</span></span>
</pre>
</td>
</tr>

</table>
<div style="border-bottom-width: 1px; border-bottom-color: #ededed; border-bottom-style: solid;">
<p dir="auto">If I understand correctly, the <code>_fast</code> version does also frees the original array if reallocation fails. What I don't fully understand is why e.g. this line uses <code>_gnutls_reallocarray_fast</code>, but line 1265 does not. Could you clarify?</p>
</div>

<p style="color: #777777;">
<a href="https://gitlab.com/ep69">Stanislav Židek</a>
started a new
discussion on <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1392#note_516422515">lib/x509/pkcs12.c</a>:
</p>
<table>
<tr class="line_holder old" id="">
<td class="old_line diff-line-num old" data-linenumber="1461" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
1461
</td>
<td class="new_line diff-line-num old" data-linenumber="1458" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#fbe9eb">
<pre style="margin: 0;">-<span id="LC1461" class="line" lang="c">                                           <span class="o" style="font-weight: 600;">++</span><span class="p">(</span><span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">chain_len</span><span class="p">));</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="old_line diff-line-num new" data-linenumber="1462" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="1458" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
1458
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC1458" class="line" lang="c">                   <span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">chain</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333;">_gnutls_reallocarray_fast</span><span class="p">(</span><span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">chain</span><span class="p">,</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="old_line diff-line-num new" data-linenumber="1462" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="1459" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
1459
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC1459" class="line" lang="c">                                                      <span class="o" style="font-weight: 600;">++</span><span class="p">(</span><span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">chain_len</span><span class="p">),</span></span>
</pre>
</td>
</tr>

</table>
<div style="border-bottom-width: 1px; border-bottom-color: #ededed; border-bottom-style: solid;">
<p dir="auto">This is inconsistent with other places that do <code>X + 1</code> most of the time (instead of <code>++X</code>). Shall we make it consistent?</p>
</div>

<p style="color: #777777;">
<a href="https://gitlab.com/ep69">Stanislav Židek</a>
started a new
discussion on <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1392#note_516422519">lib/x509/ocsp.c</a>:
</p>
<table>
<tr class="line_holder old" id="">
<td class="old_line diff-line-num old" data-linenumber="2461" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
2461
</td>
<td class="new_line diff-line-num old" data-linenumber="2460" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#fbe9eb">
<pre style="margin: 0;">-<span id="LC2461" class="line" lang="c">                   <span class="n" style="color: #333;">new_ocsps</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333;">gnutls_realloc</span><span class="p">(</span><span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">ocsps</span><span class="p">,</span> <span class="p">(</span><span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">size</span> <span class="o" style="font-weight: 600;">+</span> <span class="mi" style="color: #099;">1</span><span class="p">)</span><span class="o" style="font-weight: 600;">*</span><span class="k" style="font-weight: 600;">sizeof</span><span class="p">(</span><span class="n" style="color: #333;">gnutls_ocsp_resp_t</span><span class="p">));</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="old_line diff-line-num new" data-linenumber="2462" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="2460" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
2460
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC2460" class="line" lang="c">                   <span class="n" style="color: #333;">new_ocsps</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333;">_gnutls_reallocarray</span><span class="p">(</span><span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">ocsps</span><span class="p">,</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="old_line diff-line-num new" data-linenumber="2462" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="2461" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
2461
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC2461" class="line" lang="c">                                                    <span class="o" style="font-weight: 600;">*</span><span class="n" style="color: #333;">size</span> <span class="o" style="font-weight: 600;">+</span> <span class="mi" style="color: #099;">1</span><span class="p">,</span></span>
</pre>
</td>
</tr>

</table>
<div style="border-bottom-width: 1px; border-bottom-color: #ededed; border-bottom-style: solid;">
<p dir="auto">One generic and theoretical question: I was told at the university that allocations are pretty expensive operations and we should not use them to expand arrays only by one item. I bet there is a pretty good reason for this in multiple places here, could you perhaps explain?</p>
</div>

<p style="color: #777777;">
<a href="https://gitlab.com/ep69">Stanislav Židek</a>
started a new
discussion on <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1392#note_516422524">lib/cert-cred.c</a>:
</p>
<table>
<tr class="line_holder old" id="">
<td class="old_line diff-line-num old" data-linenumber="66" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
66
</td>
<td class="new_line diff-line-num old" data-linenumber="64" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#fbe9eb">
<pre style="margin: 0;">-<span id="LC66" class="line" lang="c">                                      <span class="k" style="font-weight: 600;">sizeof</span><span class="p">(</span><span class="n" style="color: #333;">certs_st</span><span class="p">));</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="old_line diff-line-num new" data-linenumber="67" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="64" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
64
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC64" class="line" lang="c">     <span class="n" style="color: #333;">res</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">certs</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333;"><span class="idiff left">_</span>gnutls_realloc<span class="idiff right">array</span>_fast</span><span class="p">(</span><span class="n" style="color: #333;">res</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">certs</span><span class="p">,</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="old_line diff-line-num new" data-linenumber="67" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="65" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
65
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC65" class="line" lang="c">                                      <span class="idiff left">      </span><span class="mi" style="color: #099;">1</span> <span class="o" style="font-weight: 600;">+</span> <span class="n" style="color: #333;">res</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">ncerts</span><span class="p"><span class="idiff right">,</span></span></span>
</pre>
</td>
</tr>

</table>
<div style="border-bottom-width: 1px; border-bottom-color: #ededed; border-bottom-style: solid;">
<p dir="auto">Inconsisten with the rest of the code here and on line 59 - <code>1 + X</code> vs. <code>X + 1</code>.</p>
</div>

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

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1392">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/548c3b32057834bf55655d613a80cd43/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Merge request","url":"https://gitlab.com/gnutls/gnutls/-/merge_requests/1392"}}</script>


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