From 06068df8e6540e3a88bb6d37512325886534c3c7 Mon Sep 17 00:00:00 2001 From: Ivan Chesnov Date: Tue, 20 Jun 2023 20:20:44 +0300 Subject: [PATCH] DX-61688 fixed out_len value for nullptr (#24) --- cpp/src/gandiva/gdv_function_stubs.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/src/gandiva/gdv_function_stubs.cc b/cpp/src/gandiva/gdv_function_stubs.cc index 8c6d32162cbaf..8336b89a40176 100644 --- a/cpp/src/gandiva/gdv_function_stubs.cc +++ b/cpp/src/gandiva/gdv_function_stubs.cc @@ -332,6 +332,7 @@ const char* gdv_fn_aes_encrypt(int64_t context, const char* data, int32_t data_l std::string err_msg = "Could not allocate memory for returning aes encrypt cypher text"; gdv_fn_context_set_error_msg(context, err_msg.data()); + *out_len = 0; return nullptr; } @@ -340,6 +341,7 @@ const char* gdv_fn_aes_encrypt(int64_t context, const char* data, int32_t data_l reinterpret_cast(ret)); } catch (const std::runtime_error& e) { gdv_fn_context_set_error_msg(context, e.what()); + *out_len = 0; return nullptr; } @@ -372,6 +374,7 @@ const char* gdv_fn_aes_decrypt(int64_t context, const char* data, int32_t data_l std::string err_msg = "Could not allocate memory for returning aes encrypt cypher text"; gdv_fn_context_set_error_msg(context, err_msg.data()); + *out_len = 0; return nullptr; } @@ -380,6 +383,7 @@ const char* gdv_fn_aes_decrypt(int64_t context, const char* data, int32_t data_l reinterpret_cast(ret)); } catch (const std::runtime_error& e) { gdv_fn_context_set_error_msg(context, e.what()); + *out_len = 0; return nullptr; } ret[*out_len] = '\0';