Cleared UBsan error using non-null pointer
parent
20962b51a0
commit
cac038a855
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue