Skip to content

Commit 6a7f8ba

Browse files
xxlaykxxlriggs
authored andcommitted
DX-61688 fixed out_len value for nullptr (dremio#24)
1 parent 026d230 commit 6a7f8ba

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cpp/src/gandiva/gdv_function_stubs.cc

+4
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ const char* gdv_fn_aes_encrypt(int64_t context, const char* data, int32_t data_l
332332
std::string err_msg =
333333
"Could not allocate memory for returning aes encrypt cypher text";
334334
gdv_fn_context_set_error_msg(context, err_msg.data());
335+
*out_len = 0;
335336
return nullptr;
336337
}
337338

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

@@ -372,6 +374,7 @@ const char* gdv_fn_aes_decrypt(int64_t context, const char* data, int32_t data_l
372374
std::string err_msg =
373375
"Could not allocate memory for returning aes encrypt cypher text";
374376
gdv_fn_context_set_error_msg(context, err_msg.data());
377+
*out_len = 0;
375378
return nullptr;
376379
}
377380

@@ -380,6 +383,7 @@ const char* gdv_fn_aes_decrypt(int64_t context, const char* data, int32_t data_l
380383
reinterpret_cast<unsigned char*>(ret));
381384
} catch (const std::runtime_error& e) {
382385
gdv_fn_context_set_error_msg(context, e.what());
386+
*out_len = 0;
383387
return nullptr;
384388
}
385389
ret[*out_len] = '\0';

0 commit comments

Comments
 (0)