Zoltan Borok-Nagy has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/20726 )

Change subject: IMPALA-12575: test_executor_group_num_queries_executing_metric 
fails in UBSAN build
......................................................................

IMPALA-12575: test_executor_group_num_queries_executing_metric fails in UBSAN 
build

test_executor_group_num_queries_executing_metric fails in UBSAN builds
with the Small String Optimization. It fails because it is possible to
invoke Smallify() on a StringValue where ptr is nullptr and len = 0. In
this case we call 'memcpy(rep.small_rep.buf, nullptr, 0)' internally
which is undefined behavior according to the specs. The memcpy we use
doesn't do any harm though.

This patch substitutes mempcy() to Ubsan::MemCpy() which does null
checking and only invokes memcpy() if neither of its arguments are
nulls.

There are other memcpy() invocations in SmallableString, but these
only make sense if neither of their arguments are nulls, so it's
good to have UBSAN-validation for them.

Testing:
 * tested in UBSAN build
 * added backend test for this case

Change-Id: Id937b9a975ac657e63ddb848e8c61eee75cfe17d
Reviewed-on: http://gerrit.cloudera.org:8080/20726
Tested-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Csaba Ringhofer <[email protected]>
---
M be/src/runtime/smallable-string.h
M be/src/runtime/string-value-test.cc
2 files changed, 9 insertions(+), 1 deletion(-)

Approvals:
  Impala Public Jenkins: Verified
  Csaba Ringhofer: Looks good to me, approved

--
To view, visit http://gerrit.cloudera.org:8080/20726
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id937b9a975ac657e63ddb848e8c61eee75cfe17d
Gerrit-Change-Number: 20726
Gerrit-PatchSet: 2
Gerrit-Owner: Zoltan Borok-Nagy <[email protected]>
Gerrit-Reviewer: Csaba Ringhofer <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>

Reply via email to