[Libreoffice-commits] libvisio.git: 2 commits - src/lib
Fridrich Å trba
fridrich.strba at bluewin.ch
Wed Aug 28 01:32:33 PDT 2013
src/lib/VSDXMLParserBase.cpp | 2 +-
src/lib/libvisio_utils.cpp | 13 ++++++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
New commits:
commit 12029a5fbbda72216c2a525f0680be0c2a346781
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Wed Aug 28 10:32:06 2013 +0200
Some versions of boost bomb on '=' padding characters
diff --git a/src/lib/libvisio_utils.cpp b/src/lib/libvisio_utils.cpp
index 9ad520c..0f99d5c 100644
--- a/src/lib/libvisio_utils.cpp
+++ b/src/lib/libvisio_utils.cpp
@@ -28,7 +28,9 @@
* instead of those above.
*/
+#include <vector>
#include <string>
+#include <algorithm> // std::count
#include "VSDInternalStream.h"
#include "libvisio_utils.h"
@@ -126,16 +128,21 @@ double libvisio::readDouble(WPXInputStream *input)
void libvisio::appendFromBase64(WPXBinaryData &data, const unsigned char *base64Data, size_t base64DataLength)
{
- boost::iterator_range<const char *> base64String((const char *)base64Data, (const char *)base64Data + base64DataLength);
+ std::string base64String((const char *)base64Data, base64DataLength);
+ unsigned numPadding = std::count(base64String.begin(), base64String.end(), '=');
+ std::replace(base64String.begin(),base64String.end(),'=','A'); // replace '=' by base64 encoding of '\0'
typedef boost::archive::iterators::transform_width<
boost::archive::iterators::binary_from_base64<
boost::archive::iterators::remove_whitespace< std::string::const_iterator > >, 8, 6 > base64_decoder;
std::vector<unsigned char> buffer;
std::copy(base64_decoder(base64String.begin()), base64_decoder(base64String.end()), std::back_inserter(buffer));
-
if (!buffer.empty())
- data.append(&buffer[0], buffer.size());
+ {
+ buffer.erase(buffer.end()-numPadding,buffer.end()); // erase padding '\0' characters
+ if (!buffer.empty())
+ data.append(&buffer[0], buffer.size());
+ }
}
const ::WPXString libvisio::getColourString(const Colour &c)
commit 573868072b8c7b33b6a9562724ea0df96443b17c
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Wed Aug 28 09:53:27 2013 +0200
Misleading debug message
diff --git a/src/lib/VSDXMLParserBase.cpp b/src/lib/VSDXMLParserBase.cpp
index 4dee1cd..894af90 100644
--- a/src/lib/VSDXMLParserBase.cpp
+++ b/src/lib/VSDXMLParserBase.cpp
@@ -1647,7 +1647,7 @@ void libvisio::VSDXMLParserBase::readStencil(xmlTextReaderPtr reader)
void libvisio::VSDXMLParserBase::readForeignData(xmlTextReaderPtr reader)
{
- VSD_DEBUG_MSG(("VSDXParser::readForeignData\n"));
+ VSD_DEBUG_MSG(("VSDXMLParser::readForeignData\n"));
if (!m_shape.m_foreign)
m_shape.m_foreign = new ForeignData();
More information about the Libreoffice-commits
mailing list