From 7d4a5d3dedf5d49844e148fbe8f006067478f6e2 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 18 Apr 2016 05:16:25 -0400 Subject: [PATCH] Fix assertion in DEBUG builds --- blake2.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/blake2.cpp b/blake2.cpp index 52db3403..22e63ce6 100644 --- a/blake2.cpp +++ b/blake2.cpp @@ -306,8 +306,11 @@ void BLAKE2_Base::Update(const byte *input, size_t length) } } - memcpy_s(&m_state.buffer[m_state.length], BLOCKSIZE - m_state.length, input, length); - m_state.length += static_cast(length); + if (input && length) + { + memcpy_s(&m_state.buffer[m_state.length], BLOCKSIZE - m_state.length, input, length); + m_state.length += static_cast(length); + } } template