You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2024/09/15 13:31:07 UTC
(doris) branch branch-2.1 updated: [fix](encrypt) wrong mode arg of encrypt and decrypt function make BE crash (#40726) (#40868)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new f3b1f1c19b7 [fix](encrypt) wrong mode arg of encrypt and decrypt function make BE crash (#40726) (#40868)
f3b1f1c19b7 is described below
commit f3b1f1c19b7cb5c4d93b988f24fbb26fe75d6e25
Author: camby <ca...@tencent.com>
AuthorDate: Sun Sep 15 21:31:00 2024 +0800
[fix](encrypt) wrong mode arg of encrypt and decrypt function make BE crash (#40726) (#40868)
pick #40726 to branch-2.1
---
be/src/vec/functions/function_encryption.cpp | 9 ++++++---
.../sql_functions/encryption_digest/test_encryption_function.out | 3 +++
.../encryption_digest/test_encryption_function.groovy | 3 +++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/be/src/vec/functions/function_encryption.cpp b/be/src/vec/functions/function_encryption.cpp
index c90b6a1ff60..d017f761897 100644
--- a/be/src/vec/functions/function_encryption.cpp
+++ b/be/src/vec/functions/function_encryption.cpp
@@ -244,8 +244,9 @@ struct EncryptionAndDecryptTwoImpl {
if (mode_arg.size != 0) {
if (!aes_mode_map.contains(mode_str)) {
all_insert_null = true;
+ } else {
+ encryption_mode = aes_mode_map.at(mode_str);
}
- encryption_mode = aes_mode_map.at(mode_str);
}
const ColumnString::Offsets* offsets_column = &column->get_offsets();
const ColumnString::Chars* chars_column = &column->get_chars();
@@ -371,13 +372,15 @@ struct EncryptionAndDecryptMultiImpl {
if constexpr (is_sm_mode) {
if (sm4_mode_map.count(mode_str) == 0) {
all_insert_null = true;
+ } else {
+ encryption_mode = sm4_mode_map.at(mode_str);
}
- encryption_mode = sm4_mode_map.at(mode_str);
} else {
if (aes_mode_map.count(mode_str) == 0) {
all_insert_null = true;
+ } else {
+ encryption_mode = aes_mode_map.at(mode_str);
}
- encryption_mode = aes_mode_map.at(mode_str);
}
}
diff --git a/regression-test/data/query_p0/sql_functions/encryption_digest/test_encryption_function.out b/regression-test/data/query_p0/sql_functions/encryption_digest/test_encryption_function.out
index c652b307455..3b3f06d98d8 100644
--- a/regression-test/data/query_p0/sql_functions/encryption_digest/test_encryption_function.out
+++ b/regression-test/data/query_p0/sql_functions/encryption_digest/test_encryption_function.out
@@ -272,3 +272,6 @@ zhang
-- !sql56 --
zhang
+-- !sql57 --
+\N
+
diff --git a/regression-test/suites/query_p0/sql_functions/encryption_digest/test_encryption_function.groovy b/regression-test/suites/query_p0/sql_functions/encryption_digest/test_encryption_function.groovy
index 25095f46917..69933b6fd87 100644
--- a/regression-test/suites/query_p0/sql_functions/encryption_digest/test_encryption_function.groovy
+++ b/regression-test/suites/query_p0/sql_functions/encryption_digest/test_encryption_function.groovy
@@ -226,4 +226,7 @@ suite("test_encryption_function") {
qt_sql54 """ select aes_decrypt(aes_encrypt(k,k1,k2, "AES_256_CFB"),k1,k2, "AES_256_CFB") from quantile_table2; """
qt_sql55 """ select aes_decrypt(aes_encrypt("zhang",k1,k2, "AES_256_CFB"),k1,k2, "AES_256_CFB") from quantile_table2; """
qt_sql56 """ select aes_decrypt(aes_encrypt("zhang",k1,k2, "AES_256_CFB"),k1,k2, "AES_256_CFB") from quantile_table2; """
+
+ //four arg (column/const) with wrong mode
+ qt_sql57 """ select sm4_decrypt(sm4_encrypt(k,"doris","abcdefghij", "SM4_128_CBC"),"doris","abcdefghij","SM4_555_CBC") from quantile_table2; """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org