Repository: impala Updated Branches: refs/heads/master 93a0ce857 -> 8f151d0e6
IMPALA-5031: method calls on NULL are not UBSAN-clean According to [expr.post] in the C++14 standard, a call to a member function like a->b() is interpreted as (a->b)(). In other words, the dereferencing is done separately from the call. This makes calling member functions on nullptr undefined behavior, since the dereference invokes undefined behavior. Change-Id: I8b38cb1ebba02fc163534ffcc95e4ebe41cbb115 Reviewed-on: http://gerrit.cloudera.org:8080/11950 Reviewed-by: Jim Apple <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/impala/repo Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/48d1d2d7 Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/48d1d2d7 Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/48d1d2d7 Branch: refs/heads/master Commit: 48d1d2d7421d668f8dd5142b05395e2b163f621b Parents: 93a0ce8 Author: Jim Apple <[email protected]> Authored: Sat Nov 17 19:08:21 2018 -0800 Committer: Impala Public Jenkins <[email protected]> Committed: Mon Nov 19 23:11:40 2018 +0000 ---------------------------------------------------------------------- be/src/udf/udf.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/impala/blob/48d1d2d7/be/src/udf/udf.cc ---------------------------------------------------------------------- diff --git a/be/src/udf/udf.cc b/be/src/udf/udf.cc index 5edfec3..0688805 100644 --- a/be/src/udf/udf.cc +++ b/be/src/udf/udf.cc @@ -78,9 +78,7 @@ class FreePool { class MemPool { public: - uint8_t* Allocate(int byte_size) { - // TODO: this function is called with this == nullptr from UdaTestHarness. This works - // for now because MemPool has no members or virtual functions. + static uint8_t* Allocate(int byte_size) { return reinterpret_cast<uint8_t*>(malloc(byte_size)); } };
