MDEV-8281 aes_decrypt crashes in block_crypt()

fix aes_decrypt of yassl to support zero-length input
This commit is contained in:
Sergei Golubchik 2015-06-19 18:05:10 +02:00
parent e20be69ecc
commit e7620ce4ce
3 changed files with 5 additions and 1 deletions

View file

@ -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 * *

View file

@ -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);

View file

@ -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;