You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Alexander Behm (JIRA)" <ji...@apache.org> on 2017/04/24 20:26:04 UTC

[jira] [Created] (IMPALA-5252) Java UDF returning string can lead to crash under memory pressure.

Alexander Behm created IMPALA-5252:
--------------------------------------

             Summary: Java UDF returning string can lead to crash under memory pressure.
                 Key: IMPALA-5252
                 URL: https://issues.apache.org/jira/browse/IMPALA-5252
             Project: IMPALA
          Issue Type: Bug
          Components: Backend
    Affects Versions: Impala 2.8.0
            Reporter: Alexander Behm
            Assignee: Michael Ho
            Priority: Blocker


Look at this code from hive-udf-call.cc HiveUdfCall::GetStringVal():
{code}
StringVal HiveUdfCall::GetStringVal(ExprContext* ctx, const TupleRow* row) {
  DCHECK_EQ(type_.type, TYPE_STRING);
  StringVal result = *reinterpret_cast<StringVal*>(Evaluate(ctx, row));

  // Copy the string into a local allocation with the usual lifetime for expr results.
  // Needed because the UDF output buffer is owned by the Java UDF executor and may be
  // freed or reused by the next call into the Java UDF executor.
  FunctionContext* fn_ctx = ctx->fn_context(fn_context_index_);
  uint8_t* local_alloc = fn_ctx->impl()->AllocateLocal(result.len);
  memcpy(local_alloc, result.ptr, result.len); <--- crash when local_alloc is nullptr
  result.ptr = local_alloc;
  return result;
}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)