From be282e818fc1462ade484c592e9a942926f780d8 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 18 Apr 2021 15:05:19 +0300 Subject: [PATCH] Reserve enough storage for the output in base64_decode --- source/textparser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/textparser.cpp b/source/textparser.cpp index 7ea0600..d467de8 100644 --- a/source/textparser.cpp +++ b/source/textparser.cpp @@ -314,6 +314,7 @@ bool TextParser::isodigit(int c) string TextParser::base64_decode(const string &data) { string bin; + bin.reserve(data.size()*3/4); unsigned accum = 0; unsigned a_bits = 0; for(string::const_iterator i=data.begin(); i!=data.end(); ++i) -- 2.43.0