Fix MSan report in AES functions

This commit is contained in:
Alexey Milovidov 2021-01-22 04:08:10 +03:00
parent 4e11e7cfa9
commit 56d09886e2
3 changed files with 12 additions and 0 deletions

View File

@ -303,6 +303,10 @@ private:
if constexpr (!std::is_same_v<std::nullptr_t, std::decay_t<IvColumnType>>) if constexpr (!std::is_same_v<std::nullptr_t, std::decay_t<IvColumnType>>)
{ {
iv_value = iv_column->getDataAt(r); iv_value = iv_column->getDataAt(r);
/// If the length is zero (empty string is passed) it should be treat as no IV.
if (iv_value.size == 0)
iv_value.data = nullptr;
} }
const auto input_value = input_column->getDataAt(r); const auto input_value = input_column->getDataAt(r);
@ -571,6 +575,10 @@ private:
if constexpr (!std::is_same_v<std::nullptr_t, std::decay_t<IvColumnType>>) if constexpr (!std::is_same_v<std::nullptr_t, std::decay_t<IvColumnType>>)
{ {
iv_value = iv_column->getDataAt(r); iv_value = iv_column->getDataAt(r);
/// If the length is zero (empty string is passed) it should be treat as no IV.
if (iv_value.size == 0)
iv_value.data = nullptr;
} }
auto input_value = input_column->getDataAt(r); auto input_value = input_column->getDataAt(r);

View File

@ -0,0 +1,2 @@
4DB2B0F12DE073FD063CE5478903DE68
text

View File

@ -0,0 +1,2 @@
SELECT hex(encrypt('aes-128-cbc', 'text', 'keykeykeykeykeyk', ''));
SELECT decrypt('aes-128-cbc', encrypt('aes-128-cbc', 'text', 'keykeykeykeykeyk', ''), 'keykeykeykeykeyk', '');