git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67303 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
 // 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(m_dataSize+1) < bufSize)
+        bufSize = m_dataSize+1;
+    char* buf = new char[bufSize+1];
 
     int left = m_dataSize;
     int n, i, j;
         buf[n] = 0;
         stream.Write((const char*) buf, n);
     }
+    delete[] buf;
     return true;
 }