[Libreoffice-commits] libmspub.git: 2 commits - src/fuzz src/lib
David Tardon
dtardon at redhat.com
Wed Mar 29 19:49:42 UTC 2017
src/fuzz/pubfuzzer.cpp | 8 ++++----
src/lib/MSPUBParser.cpp | 24 +++++++++---------------
src/lib/PolygonUtils.cpp | 2 +-
3 files changed, 14 insertions(+), 20 deletions(-)
New commits:
commit 79ef317f2a2ed73723c685dff61437b908779f9f
Author: David Tardon <dtardon at redhat.com>
Date: Wed Mar 29 21:48:53 2017 +0200
astyle
Change-Id: I1ee2f184961cc2350acc47ea13bbc2aec4f0f35f
diff --git a/src/fuzz/pubfuzzer.cpp b/src/fuzz/pubfuzzer.cpp
index 7a9ab5f..17ad8ec 100644
--- a/src/fuzz/pubfuzzer.cpp
+++ b/src/fuzz/pubfuzzer.cpp
@@ -18,10 +18,10 @@
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
- librevenge::RVNGStringStream input(data, size);
- librevenge::RVNGRawDrawingGenerator generator(true);
- libmspub::MSPUBDocument::parse(&input, &generator);
- return 0;
+ librevenge::RVNGStringStream input(data, size);
+ librevenge::RVNGRawDrawingGenerator generator(true);
+ libmspub::MSPUBDocument::parse(&input, &generator);
+ return 0;
}
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/PolygonUtils.cpp b/src/lib/PolygonUtils.cpp
index 9ef8466..5ea0c3f 100644
--- a/src/lib/PolygonUtils.cpp
+++ b/src/lib/PolygonUtils.cpp
@@ -2223,7 +2223,7 @@ const CustomShape CS_HOME_PLATE(
const Vertex ARROW_VERTICES[] =
{
- {0, CALCULATED_VALUE(0)}, {CALCULATED_VALUE(1), CALCULATED_VALUE(0) }, {CALCULATED_VALUE(1) , 0}, {21600, 10800}, {CALCULATED_VALUE(1) , 21600}, {CALCULATED_VALUE(1) , CALCULATED_VALUE(2) }, {0, CALCULATED_VALUE(2) }
+ {0, CALCULATED_VALUE(0)}, {CALCULATED_VALUE(1), CALCULATED_VALUE(0) }, {CALCULATED_VALUE(1), 0}, {21600, 10800}, {CALCULATED_VALUE(1), 21600}, {CALCULATED_VALUE(1), CALCULATED_VALUE(2) }, {0, CALCULATED_VALUE(2) }
};
const unsigned short ARROW_SEGMENTS[] =
commit 4fcf4c65e9a9c059ae1664c16ccf0a848a5d1b00
Author: David Tardon <dtardon at redhat.com>
Date: Wed Mar 29 21:48:02 2017 +0200
avoid leak even if an exception is thrown
Change-Id: Ia1e798defd622cb19b3abaab1bd2ee7a512fc486
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 9c746d7..992d62d 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -16,6 +16,7 @@
#include <string.h>
#include <boost/numeric/conversion/cast.hpp>
+#include <boost/scoped_ptr.hpp>
#include <librevenge-stream/librevenge-stream.h>
#include <zlib.h>
@@ -126,51 +127,44 @@ bool MSPUBParser::parse()
return false;
// No check: metadata are not important enough to fail if they can't be parsed
parseMetaData();
- librevenge::RVNGInputStream *quill = m_input->getSubStreamByName("Quill/QuillSub/CONTENTS");
+ boost::scoped_ptr<librevenge::RVNGInputStream> quill(m_input->getSubStreamByName("Quill/QuillSub/CONTENTS"));
if (!quill)
{
MSPUB_DEBUG_MSG(("Couldn't get quill stream.\n"));
return false;
}
- if (!parseQuill(quill))
+ if (!parseQuill(quill.get()))
{
MSPUB_DEBUG_MSG(("Couldn't parse quill stream.\n"));
- delete quill;
return false;
}
- delete quill;
- librevenge::RVNGInputStream *contents = m_input->getSubStreamByName("Contents");
+ boost::scoped_ptr<librevenge::RVNGInputStream> contents(m_input->getSubStreamByName("Contents"));
if (!contents)
{
MSPUB_DEBUG_MSG(("Couldn't get contents stream.\n"));
return false;
}
- if (!parseContents(contents))
+ if (!parseContents(contents.get()))
{
MSPUB_DEBUG_MSG(("Couldn't parse contents stream.\n"));
- delete contents;
return false;
}
- delete contents;
- librevenge::RVNGInputStream *escherDelay = m_input->getSubStreamByName("Escher/EscherDelayStm");
+ boost::scoped_ptr<librevenge::RVNGInputStream> escherDelay(m_input->getSubStreamByName("Escher/EscherDelayStm"));
if (escherDelay)
{
- parseEscherDelay(escherDelay);
- delete escherDelay;
+ parseEscherDelay(escherDelay.get());
}
- librevenge::RVNGInputStream *escher = m_input->getSubStreamByName("Escher/EscherStm");
+ boost::scoped_ptr<librevenge::RVNGInputStream> escher(m_input->getSubStreamByName("Escher/EscherStm"));
if (!escher)
{
MSPUB_DEBUG_MSG(("Couldn't get escher stream.\n"));
return false;
}
- if (!parseEscher(escher))
+ if (!parseEscher(escher.get()))
{
MSPUB_DEBUG_MSG(("Couldn't parse escher stream.\n"));
- delete escher;
return false;
}
- delete escher;
return m_collector->go();
}
More information about the Libreoffice-commits
mailing list