Jim Apple has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/11195


Change subject: IMPALA-5031: Remove some undefined behavior of NULL pointers
......................................................................

IMPALA-5031: Remove some undefined behavior of NULL pointers

This was found in ExprTest.LiteralExprs. The rules vioalted are:

1. "reference binding to null pointer of type 'long'". This violates
the standard's [dcl.ref]:

    a null reference cannot exist in a well-defined program, because
    the only way to create such a reference would be to bind it to the
    "object" obtained by indirection through a null pointer, which
    causes undefined behavior.

The interesting part of the backtrace is:

    #1 RuntimeProfile::TimeSeriesCounter::ToThrift(TTimeSeriesCounter*) 
util/runtime-profile.cc:1117:11
    #2 RuntimeProfile::ToThrift(std::vector<TRuntimeProfileNode>*) const 
util/runtime-profile.cc:905:21
    #3 RuntimeProfile::ToThrift(TRuntimeProfileTree*) const 
util/runtime-profile.cc:847:3
    #4 QueryState::ReportExecStatusAux(bool, Status const&, 
FragmentInstanceState*, bool) runtime/query-state.cc:281:21
    #5 QueryState::ReportExecStatus(bool, Status const&, 
FragmentInstanceState*) runtime/query-state.cc:250:3
    #6 FragmentInstanceState::SendReport(bool, Status const&) 
runtime/fragment-instance-state.cc:406:17
    #7 FragmentInstanceState::Finalize(Status const&) 
runtime/fragment-instance-state.cc:496:3

2. The use of a null pointer when calling memcpy. According to "7.1.4
Use of library functions" in the C99 standard (which is included in
C++14 in section [intro.refs]:

    If an argument to a function has an invalid value (such as a value
    outside the domain of the function, or a pointer outside the
    address space of the program, or a null pointer, or a pointer to
    non-modifiable storage when the corresponding parameter is not
    const-qualified) or a type (after promotion) not expected by a
    function with variable number of arguments, the behavior is
    undefined.

The interesting part of the backtrace is the same as above.

Change-Id: I3c8a6624918389396789a83b32dbf068b9327f76
---
M be/src/util/runtime-profile.cc
M be/src/util/ubsan.h
2 files changed, 9 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/95/11195/1
--
To view, visit http://gerrit.cloudera.org:8080/11195
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c8a6624918389396789a83b32dbf068b9327f76
Gerrit-Change-Number: 11195
Gerrit-PatchSet: 1
Gerrit-Owner: Jim Apple <[email protected]>

Reply via email to