X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/616c7cbd92e7b6f6510cc7169fad8856e0e1397c..54580df4e2faf875a73b59913b618731cb582b67:/src/richtext/richtextbuffer.cpp diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 932a824ed7..c095af9c78 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -10417,8 +10417,13 @@ bool wxRichTextImageBlock::Load(wxImage& image) // Write data in hex to a stream bool wxRichTextImageBlock::WriteHex(wxOutputStream& stream) { - const int bufSize = 512; - char buf[bufSize+1]; + if (m_dataSize == 0) + return true; + + int bufSize = 100000; + if (int(2*m_dataSize) < bufSize) + bufSize = 2*m_dataSize; + char* buf = new char[bufSize+1]; int left = m_dataSize; int n, i, j; @@ -10444,6 +10449,7 @@ bool wxRichTextImageBlock::WriteHex(wxOutputStream& stream) buf[n] = 0; stream.Write((const char*) buf, n); } + delete[] buf; return true; }