<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 24, 2015 at 5:54 AM, Emilia Käsper <span dir="ltr"><<a href="mailto:emilia@openssl.org" target="_blank">emilia@openssl.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">commit c028254b12 fixes 1., 2. and 3. (also applied to 1.0.2).<div>commit 53dd4ddf71 fixes 5 and some of 4.</div><div><br></div><div>Still ploughing my way through the rest of error checking.</div><div> <br></div></div></blockquote><div><br></div><div>Great.</div><div><br></div><div>I want to call your attention to one particularly non-obvious failure to handle errors correctly:</div><div><br></div><div><div>static void ecp_nistz256_windowed_mul([...], P256_POINT *r, [...])</div><div>{<br></div><div>    [...]</div><div><br></div><div>    if ((num * 16 + 6) > OPENSSL_MALLOC_MAX_NELEMS(P256_POINT)<br></div><div>        || (table_storage =</div><div>            OPENSSL_malloc((num * 16 + 5) * sizeof(P256_POINT) + 64)) == NULL</div><div>        || (p_str =</div><div>            OPENSSL_malloc(num * 33 * sizeof(unsigned char))) == NULL</div><div>        || (scalars = OPENSSL_malloc(num * sizeof(BIGNUM *))) == NULL) {</div><div>        ECerr(EC_F_ECP_NISTZ256_WINDOWED_MUL, ERR_R_MALLOC_FAILURE);</div><div>        goto err;</div><div>    }</div><div>   </div><div>    [...]</div><div><br></div></div><div>err:</div><div>    [...]</div><div>}</div><div><br></div><div>ecp_nistz256_windowed_mul checks for errors, but it doesn't report the fact that an error occurred to the caller, because it has return type |void|. And, the caller doesn't check that ecp_nistz256_windowed_mul failed; it can't because of the void return type.</div><div><br></div><div>Cheers,</div><div>Brian</div><div><br></div></div></div></div>