You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2019/06/25 15:45:31 UTC
[impala] 19/20: IMPALA-5031: Fix undefined behavior: memset NULL
This is an automated email from the ASF dual-hosted git repository.
tarmstrong pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 446939f818d43a5be2967f1d8db26c42bc34cf54
Author: Jim Apple <jb...@apache.org>
AuthorDate: Tue Jul 24 15:40:56 2018 -0700
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>
---
be/src/util/bitmap.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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_; }