From: Mikko Rasa Date: Sun, 18 Apr 2021 12:05:19 +0000 (+0300) Subject: Reserve enough storage for the output in base64_decode X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=be282e818fc1462ade484c592e9a942926f780d8;p=libs%2Fdatafile.git Reserve enough storage for the output in base64_decode --- 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)