Commit e7620ce4 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-8281 aes_decrypt crashes in block_crypt()

fix aes_decrypt of yassl to support zero-length input
parent e20be69e
......@@ -264,6 +264,9 @@ NULL
select aes_decrypt(aes_encrypt("","a"),"a");
aes_decrypt(aes_encrypt("","a"),"a")
select aes_decrypt("", "a");
aes_decrypt("", "a")
NULL
select repeat('monty',5),concat('*',space(5),'*');
repeat('monty',5) concat('*',space(5),'*')
montymontymontymontymonty * *
......
......@@ -105,6 +105,7 @@ select aes_decrypt(NULL,"a");
select aes_decrypt("a",NULL);
select aes_decrypt("a","a");
select aes_decrypt(aes_encrypt("","a"),"a");
select aes_decrypt("", "a");
select repeat('monty',5),concat('*',space(5),'*');
select reverse('abc'),reverse('abcd');
select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12'), rpad(11, 10 , 22), rpad("ab", 10, 22);
......
......@@ -104,7 +104,7 @@ static int block_crypt(CipherMode cipher, Dir dir,
}
else
{
int n= dest[source_length - 1];
int n= source_length ? dest[source_length - 1] : 0;
if (tail || n == 0 || n > MY_AES_BLOCK_SIZE)
return MY_AES_BAD_DATA;
*dest_length-= n;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment