From 5d78d879bb82d2466fe38ccaa3446fd74bf74b3b Mon Sep 17 00:00:00 2001 From: ibanic Date: Sat, 15 May 2021 22:32:24 +0200 Subject: Prevent accessing empty buffer --- src/vmime/charsetConverter_icu.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/vmime/charsetConverter_icu.cpp b/src/vmime/charsetConverter_icu.cpp index 56394797..faae7d32 100644 --- a/src/vmime/charsetConverter_icu.cpp +++ b/src/vmime/charsetConverter_icu.cpp @@ -433,6 +433,8 @@ void charsetFilteredOutputStream_icu::writeImpl( } const size_t uniLength = uniTarget - &uniBuffer[0]; + if(uniLength == 0) + continue; // Allocate buffer for destination charset const size_t cpSize = ucnv_getMinCharSize(m_to) * uniLength; @@ -520,6 +522,8 @@ void charsetFilteredOutputStream_icu::flush() { } const size_t uniLength = uniTarget - &uniBuffer[0]; + if(uniLength == 0) + continue; // Allocate buffer for destination charset const size_t cpSize = ucnv_getMinCharSize(m_to) * uniLength; -- cgit v1.2.3