You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ar...@apache.org on 2018/07/25 19:28:15 UTC

[04/10] impala git commit: IMPALA-5031: Fix undefined behavior: memset NULL

IMPALA-5031: Fix undefined behavior: memset NULL

memset has undefined behavior when its first argument is NULL. The
instance fixed here was found by Clang's undefined behavior sanitizer.

It was found in the end-to-end tests. The interesting part of the
stack trace is:

be/src/util/bitmap.h:78:12: runtime error: null pointer passed as argument 1, which is declared to never be null
/usr/include/string.h:62:79: note: nonnull attribute specified here
    #0 0x2ccb59b in Bitmap::SetAllBits(bool) be/src/util/bitmap.h:78:5
    #1 0x2cb6b9e in NestedLoopJoinNode::ResetMatchingBuildRows(RuntimeState*, long) be/src/exec/nested-loop-join-node.cc:176:27
    #2 0x2cb5ad6 in NestedLoopJoinNode::Open(RuntimeState*) be/src/exec/nested-loop-join-node.cc:90:43

Change-Id: I804f642f4be3b74c24f871f656c5147ee226d2c8
Reviewed-on: http://gerrit.cloudera.org:8080/11042
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/cdc8b9ba
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/cdc8b9ba
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/cdc8b9ba

Branch: refs/heads/master
Commit: cdc8b9ba78e6ac336160a916a630ec2b99e3d9f8
Parents: b76207c
Author: Jim Apple <jb...@apache.org>
Authored: Tue Jul 24 15:40:56 2018 -0700
Committer: Impala Public Jenkins <im...@cloudera.com>
Committed: Wed Jul 25 06:29:14 2018 +0000

----------------------------------------------------------------------
 be/src/util/bitmap.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/cdc8b9ba/be/src/util/bitmap.h
----------------------------------------------------------------------
diff --git a/be/src/util/bitmap.h b/be/src/util/bitmap.h
index b2f7f72..ced824b 100644
--- a/be/src/util/bitmap.h
+++ b/be/src/util/bitmap.h
@@ -20,6 +20,7 @@
 #define IMPALA_UTIL_BITMAP_H
 
 #include "util/bit-util.h"
+#include "util/ubsan.h"
 
 namespace impala {
 
@@ -75,7 +76,7 @@ class Bitmap {
   }
 
   void SetAllBits(bool b) {
-    memset(buffer_.data(), 255 * b, buffer_.size() * sizeof(uint64_t));
+    Ubsan::MemSet(buffer_.data(), 255 * b, buffer_.size() * sizeof(uint64_t));
   }
 
   int64_t num_bits() const { return num_bits_; }