Skip to content

Commit

Permalink
DX-61688 fixed out_len value for nullptr (dremio#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
xxlaykxx authored and lriggs committed Apr 25, 2024
1 parent 8404e8f commit 06068df
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cpp/src/gandiva/gdv_function_stubs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -340,6 +341,7 @@ const char* gdv_fn_aes_encrypt(int64_t context, const char* data, int32_t data_l
reinterpret_cast<unsigned char*>(ret));
} catch (const std::runtime_error& e) {
gdv_fn_context_set_error_msg(context, e.what());
*out_len = 0;
return nullptr;
}

Expand Down Expand Up @@ -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;
}

Expand All @@ -380,6 +383,7 @@ const char* gdv_fn_aes_decrypt(int64_t context, const char* data, int32_t data_l
reinterpret_cast<unsigned char*>(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';
Expand Down

0 comments on commit 06068df

Please sign in to comment.