Skip to content

Commit

Permalink
MDEV-19617 Assertion `src' failed in MyCTX::update
Browse files Browse the repository at this point in the history
Apprently, sometimes there will be null pointers with 0 length
passed to the MyCTX::update() function, and  will need to return
a valid buffer.

So weaken the assertion, and use a valid pointer for src if it was NULL.
  • Loading branch information
vaintroub committed May 28, 2019
1 parent 5e36f5d commit 1df42a2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion mysys_ssl/my_crypt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@ class MyCTX
}
virtual int update(const uchar *src, uint slen, uchar *dst, uint *dlen)
{
DBUG_ASSERT(src);
#ifdef HAVE_WOLFSSL
// WolfSSL checks parameters and does not like NULL pointers to be passed to function below.
if (!src)
{
static const uchar dummy[MY_AES_BLOCK_SIZE];
DBUG_ASSERT(!slen);
src=dummy;
}
#endif

if (EVP_CipherUpdate(ctx, dst, (int*)dlen, src, slen) != 1)
return MY_AES_OPENSSL_ERROR;
return MY_AES_OK;
Expand Down

0 comments on commit 1df42a2

Please sign in to comment.