From 26459c47f867dc1882fa7b87e32a9e8fc5e125e5 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Mon, 13 Jul 2020 08:34:07 +0000 Subject: [PATCH] Bug 1650811 - Make Base64 compatible with ReadSegments() with small buffers. r=asuth, a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D82522 --- netwerk/test/gtest/moz.build | 1 + xpcom/io/Base64.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/netwerk/test/gtest/moz.build b/netwerk/test/gtest/moz.build index 34a06c9943ac..fa7c90ff3bdd 100644 --- a/netwerk/test/gtest/moz.build +++ b/netwerk/test/gtest/moz.build @@ -6,6 +6,7 @@ UNIFIED_SOURCES += [ 'TestBase64Stream.cpp', + 'TestBufferedInputStream.cpp', 'TestHeaders.cpp', 'TestHttpAuthUtils.cpp', 'TestProtocolProxyService.cpp', diff --git a/xpcom/io/Base64.cpp b/xpcom/io/Base64.cpp index 2f9f50b6528b..72ad070c4bf5 100644 --- a/xpcom/io/Base64.cpp +++ b/xpcom/io/Base64.cpp @@ -107,6 +107,9 @@ nsresult EncodeInputStream_Encoder(nsIInputStream* aStream, void* aClosure, // We consume the whole data always. *aWriteCount = aCount; + // We consume the whole data always. + *aWriteCount = aCount; + // If we have any data left from last time, encode it now. uint32_t countRemaining = aCount; const unsigned char* src = (const unsigned char*)aFromSegment;