From cac038a855700fb36f4078c34487e86d60e03682 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 17 Jul 2015 21:50:47 -0400 Subject: Cleared UBsan error using non-null pointer --- queue.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'queue.cpp') diff --git a/queue.cpp b/queue.cpp index ff2f0d31..6546522b 100644 --- a/queue.cpp +++ b/queue.cpp @@ -41,6 +41,7 @@ public: inline size_t Put(const byte *begin, size_t length) { + if(!begin || !length) return length; size_t l = STDMIN(length, MaxSize()-m_tail); if (buf+m_tail != begin) memcpy(buf+m_tail, begin, l); @@ -59,6 +60,7 @@ public: inline size_t Peek(byte *target, size_t copyMax) const { + if(!target || !copyMax) return 0; size_t len = STDMIN(copyMax, m_tail-m_head); memcpy(target, buf+m_head, len); return len; -- cgit v1.2.1