configure.ac | 2 +- src/lib/CDRContentCollector.cpp | 5 ++++- src/lib/CDRParser.cpp | 8 ++++---- src/lib/CDRParser.h | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-)
New commits: commit 6448d30053f59f1b71cd841629d053f6bf071d82 Author: David Tardon <dtar...@redhat.com> Date: Tue Jun 3 18:56:41 2014 +0200 coverity#1219654 avoid possible out-of-bounds access Change-Id: I44de7037a9e3a65b539f452aace782683121ba83 diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp index 853c5e0..70fa511 100644 --- a/src/lib/CDRParser.cpp +++ b/src/lib/CDRParser.cpp @@ -483,7 +483,7 @@ void libcdr::CDRParser::readWaldoLoda(librevenge::RVNGInputStream *input, unsign input->seek(startPosition + length, librevenge::RVNG_SEEK_SET); } -bool libcdr::CDRParser::parseRecords(librevenge::RVNGInputStream *input, unsigned *blockLengths, unsigned level) +bool libcdr::CDRParser::parseRecords(librevenge::RVNGInputStream *input, const std::vector<unsigned> &blockLengths, unsigned level) { if (!input) { @@ -498,7 +498,7 @@ bool libcdr::CDRParser::parseRecords(librevenge::RVNGInputStream *input, unsigne return true; } -bool libcdr::CDRParser::parseRecord(librevenge::RVNGInputStream *input, unsigned *blockLengths, unsigned level) +bool libcdr::CDRParser::parseRecord(librevenge::RVNGInputStream *input, const std::vector<unsigned> &blockLengths, unsigned level) { if (!input) { @@ -516,7 +516,7 @@ bool libcdr::CDRParser::parseRecord(librevenge::RVNGInputStream *input, unsigned return true; unsigned fourCC = readU32(input); unsigned length = readU32(input); - if (blockLengths) + if (blockLengths.size() > length) length=blockLengths[length]; unsigned long position = input->tell(); unsigned listType(0); @@ -576,7 +576,7 @@ bool libcdr::CDRParser::parseRecord(librevenge::RVNGInputStream *input, unsigned CDRInternalStream tmpBlocksStream(input, blocksLength, compressed); while (!tmpBlocksStream.isEnd()) tmpBlockLengths.push_back(readU32(&tmpBlocksStream)); - if (!parseRecords(&tmpStream, tmpBlockLengths.size() ? &tmpBlockLengths[0] : 0, level+1)) + if (!parseRecords(&tmpStream, tmpBlockLengths, level+1)) return false; } } diff --git a/src/lib/CDRParser.h b/src/lib/CDRParser.h index d959507..31f7ec7 100644 --- a/src/lib/CDRParser.h +++ b/src/lib/CDRParser.h @@ -29,7 +29,7 @@ class CDRParser : protected CommonParser public: explicit CDRParser(const std::vector<librevenge::RVNGInputStream *> &externalStreams, CDRCollector *collector); virtual ~CDRParser(); - bool parseRecords(librevenge::RVNGInputStream *input, unsigned *blockLengths = 0, unsigned level = 0); + bool parseRecords(librevenge::RVNGInputStream *input, const std::vector<unsigned> &blockLengths = std::vector<unsigned>(), unsigned level = 0); bool parseWaldo(librevenge::RVNGInputStream *input); private: @@ -44,7 +44,7 @@ private: std::map<unsigned, WaldoRecordInfo> &records6, std::map<unsigned, WaldoRecordInfo> &records7, std::map<unsigned, WaldoRecordInfo> &records8, std::map<unsigned, WaldoRecordInfo> recordsOther); void readWaldoRecord(librevenge::RVNGInputStream *input, const WaldoRecordInfo &info); - bool parseRecord(librevenge::RVNGInputStream *input, unsigned *blockLengths = 0, unsigned level = 0); + bool parseRecord(librevenge::RVNGInputStream *input, const std::vector<unsigned> &blockLengths = std::vector<unsigned>(), unsigned level = 0); void readRecord(unsigned fourCC, unsigned length, librevenge::RVNGInputStream *input); double readRectCoord(librevenge::RVNGInputStream *input); CDRColor readColor(librevenge::RVNGInputStream *input); commit b29f874bb1e8c15b2c77e094d4431a59662e0283 Author: David Tardon <dtar...@redhat.com> Date: Tue Jun 3 18:42:16 2014 +0200 coverity#1219811 dereference null return value Change-Id: I2cff394e32ce6bc7bf39fae09d91a9730ad8f656 diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp index 5c4ea97..af26ad7 100644 --- a/src/lib/CDRContentCollector.cpp +++ b/src/lib/CDRContentCollector.cpp @@ -1186,6 +1186,9 @@ void libcdr::CDRContentCollector::collectSpnd(unsigned spnd) void libcdr::CDRContentCollector::collectVectorPattern(unsigned id, const librevenge::RVNGBinaryData &data) { librevenge::RVNGInputStream *input = data.getDataStream(); + if (!input) + return; + input->seek(0, librevenge::RVNG_SEEK_SET); if (!libcdr::CMXDocument::isSupported(input)) return; commit f8c8a0d09c0614d7b0794b09b5d3fcaba84294b1 Author: David Tardon <dtar...@redhat.com> Date: Tue Jun 3 18:39:53 2014 +0200 the const_cast is no longer necessary Change-Id: I802fd594660761e5ee112fa096f6f4c8fcc97cbb diff --git a/configure.ac b/configure.ac index ec7cd3a..a216684 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,7 @@ PKG_PROG_PKG_CONFIG([0.20]) # Find librevenge # =============== PKG_CHECK_MODULES([REVENGE],[ - librevenge-0.0 + librevenge-0.0 >= 0.0.1 ]) AC_SUBST([REVENGE_CFLAGS]) AC_SUBST([REVENGE_LIBS]) diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp index c199aed..5c4ea97 100644 --- a/src/lib/CDRContentCollector.cpp +++ b/src/lib/CDRContentCollector.cpp @@ -1185,7 +1185,7 @@ void libcdr::CDRContentCollector::collectSpnd(unsigned spnd) void libcdr::CDRContentCollector::collectVectorPattern(unsigned id, const librevenge::RVNGBinaryData &data) { - librevenge::RVNGInputStream *input = const_cast<librevenge::RVNGInputStream *>(data.getDataStream()); + librevenge::RVNGInputStream *input = data.getDataStream(); input->seek(0, librevenge::RVNG_SEEK_SET); if (!libcdr::CMXDocument::isSupported(input)) return; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits