Skip to content

Commit

Permalink
Fix Coverity issues 1596850, 1596851 and 1596852
Browse files Browse the repository at this point in the history
These are newly introduced memory leaks and UAF in evp_test.c
  • Loading branch information
t8m committed May 6, 2024
1 parent 1c4f968 commit 6fe766f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/evp_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ static int parse_bin_chunk(const char *value, size_t offset, size_t max,
return -1;
if (!TEST_ptr(*buf = OPENSSL_hexstr2buf(chunk, &len))) {
OPENSSL_free(chunk);
TEST_info("Can't convert chunk %s", chunk);
TEST_openssl_errors();
return -1;
}
OPENSSL_free(chunk);
*buflen = len;
}
*out_offset = value[0] == '"' ? offset + (*buflen) : offset + 2 * (*buflen);
Expand Down Expand Up @@ -742,6 +742,8 @@ static int cipher_test_init(EVP_TEST *t, const char *alg)

if (data_chunk_size != 0 && !cipher_test_valid_fragmentation(cdat)) {
ERR_pop_to_mark();
EVP_CIPHER_free(fetched_cipher);
OPENSSL_free(cdat);
t->skip = 1;
TEST_info("skipping, '%s' does not support fragmentation", alg);
return 1;
Expand Down

0 comments on commit 6fe766f

Please sign in to comment.