summaryrefslogtreecommitdiff
path: root/queue.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2015-07-17 21:50:47 -0400
committerJeffrey Walton <noloader@gmail.com>2015-07-17 21:50:47 -0400
commitcac038a855700fb36f4078c34487e86d60e03682 (patch)
treee623f11a2f25d14d572ed82ab6e191a2f01f3ab4 /queue.cpp
parent20962b51a04ca04fa6a3209c2262afb795249871 (diff)
downloadcryptopp-git-cac038a855700fb36f4078c34487e86d60e03682.tar.gz
Cleared UBsan error using non-null pointer
Diffstat (limited to 'queue.cpp')
-rw-r--r--queue.cpp2
1 files changed, 2 insertions, 0 deletions
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;