You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by zh...@apache.org on 2020/06/13 04:43:53 UTC
[incubator-doris] branch master updated: Avoid pass NULL to
memcmp() (#3844)
This is an automated email from the ASF dual-hosted git repository.
zhaoc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 83d39ff Avoid pass NULL to memcmp() (#3844)
83d39ff is described below
commit 83d39ff9c96f33b413341fb0c56da24bfd850ff8
Author: HuangWei <hu...@xiaomi.com>
AuthorDate: Sat Jun 13 12:43:41 2020 +0800
Avoid pass NULL to memcmp() (#3844)
If we exec "StringVal(len=0, ptr="") == StringVal(len=0,ptr=NULL)", it will pass NULL ptr to memcmp(). It should be avoided.
---
be/src/udf/udf.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/be/src/udf/udf.h b/be/src/udf/udf.h
index 9013d20..3ed500d 100755
--- a/be/src/udf/udf.h
+++ b/be/src/udf/udf.h
@@ -644,7 +644,7 @@ struct StringVal : public AnyVal {
return false;
}
- return ptr == other.ptr || memcmp(ptr, other.ptr, len) == 0;
+ return len == 0 || ptr == other.ptr || memcmp(ptr, other.ptr, len) == 0;
}
bool operator!=(const StringVal& other) const {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org