Skip to content

Commit

Permalink
[CBRD-24601] Defense code to prevent segfault by function call of NUL…
Browse files Browse the repository at this point in the history
…L pointer object in method_scan (#4018) (#4019)

http://jira.cubrid.org/browse/CBRD-24601

backport of #4018
  • Loading branch information
hgryoo authored Dec 28, 2022
1 parent 9ae512d commit 24224de
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/method/method_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ namespace cubscan
if (m_method_group == nullptr) // signature is not initialized
{
m_method_group = cubmethod::get_rctx (thread_p)->create_invoke_group (thread_p, *sig_list, true);
if (!m_method_group)
{
er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_OUT_OF_VIRTUAL_MEMORY, 1,
(size_t) sizeof (cubmethod::method_invoke_group));
return ER_OUT_OF_VIRTUAL_MEMORY;
}
}

if (m_list_id == nullptr)
Expand Down Expand Up @@ -100,7 +106,7 @@ namespace cubscan
close_value_array ();
pr_clear_value_vector (m_arg_vector);

if (is_final)
if (is_final && m_method_group)
{
m_method_group->reset (true);
m_method_group->end ();
Expand Down

0 comments on commit 24224de

Please sign in to comment.