[Libreoffice-commits] libcdr.git: 4 commits - src/lib

David Tardon dtardon at redhat.com
Sat May 11 07:04:42 PDT 2013


 src/lib/CDRCollector.cpp |    2 ++
 src/lib/CDRParser.cpp    |    9 +++++++--
 src/lib/CDRZipStream.cpp |    2 ++
 src/lib/libcdr_utils.cpp |    3 +++
 4 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 4cd2e20ed2c21dcf0b7b30a9e297d763f9910f0a
Author: David Tardon <dtardon at redhat.com>
Date:   Sat May 11 15:59:06 2013 +0200

    handle broken internal streams

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index 1dfcec5..9e1e8ed 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -2419,8 +2419,13 @@ bool libcdr::CDRParser::_redirectX6Chunk(WPXInputStream **input, unsigned &lengt
     {
       unsigned streamOffset = readU32(*input);
       *input = m_externalStreams[streamNumber];
-      (*input)->seek(streamOffset, WPX_SEEK_SET);
-      return true;
+      if (*input)
+      {
+        (*input)->seek(streamOffset, WPX_SEEK_SET);
+        return !(*input)->atEOS();
+      }
+      else
+        return false;
     }
     else if (streamNumber == 0xffffffff)
       return true;
commit d6c0337db446820d14d2dc9c3c4edb22955dbc02
Author: David Tardon <dtardon at redhat.com>
Date:   Sat May 11 15:40:59 2013 +0200

    return if profile creation failed

diff --git a/src/lib/CDRCollector.cpp b/src/lib/CDRCollector.cpp
index b4c0be8..bf386b4 100644
--- a/src/lib/CDRCollector.cpp
+++ b/src/lib/CDRCollector.cpp
@@ -62,6 +62,8 @@ void libcdr::CDRParserState::setColorTransform(const std::vector<unsigned char>
   if (profile.empty())
     return;
   cmsHPROFILE tmpProfile = cmsOpenProfileFromMem(&profile[0], cmsUInt32Number(profile.size()));
+  if (!tmpProfile)
+    return;
   cmsHPROFILE tmpRGBProfile = cmsCreate_sRGBProfile();
   cmsColorSpaceSignature signature = cmsGetColorSpace(tmpProfile);
   switch (signature)
commit 687bf90feb08cbfffa27d9965775e6815e06a87e
Author: David Tardon <dtardon at redhat.com>
Date:   Sat May 11 16:03:31 2013 +0200

    avoid deref. of past-the-end iterator

diff --git a/src/lib/CDRZipStream.cpp b/src/lib/CDRZipStream.cpp
index 687bea3..d904057 100644
--- a/src/lib/CDRZipStream.cpp
+++ b/src/lib/CDRZipStream.cpp
@@ -206,6 +206,8 @@ bool libcdr::CDRZipStreamImpl::isZipStream()
     return false;
   if (!readCentralDirectory(end))
     return false;
+  if (m_cdir.empty())
+    return false;
   CentralDirectoryEntry entry = m_cdir.begin()->second;
   m_input->seek(entry.offset, WPX_SEEK_SET);
   LocalFileHeader header;
commit 06c7ff400e89939c9cf5b274b032a21d61bf59fb
Author: David Tardon <dtardon at redhat.com>
Date:   Sat May 11 16:02:09 2013 +0200

    return early if there are no chars to append

diff --git a/src/lib/libcdr_utils.cpp b/src/lib/libcdr_utils.cpp
index 74d6ed4..3b095d1 100644
--- a/src/lib/libcdr_utils.cpp
+++ b/src/lib/libcdr_utils.cpp
@@ -427,6 +427,9 @@ void libcdr::appendCharacters(WPXString &text, std::vector<unsigned char> charac
 
 void libcdr::appendCharacters(WPXString &text, std::vector<unsigned char> characters)
 {
+  if (characters.empty())
+    return;
+
   UErrorCode status = U_ZERO_ERROR;
   UConverter *conv = ucnv_open("UTF-16LE", &status);
 


More information about the Libreoffice-commits mailing list