[libcdr] Resolves: rhbz#891082 libreoffice Impress constantly crashes

David Tardon dtardon at fedoraproject.org
Tue Jan 8 10:33:18 UTC 2013


commit 310b760ac2ef417101d020bc659671b460623b4e
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Jan 8 11:32:57 2013 +0100

    Resolves: rhbz#891082 libreoffice Impress constantly crashes

 ...verity-do-not-let-CDRDocument-parse-throw.patch |   35 ++++++++++++++++++++
 ...-do-not-let-CMXDocument-isSupported-throw.patch |   35 ++++++++++++++++++++
 libcdr.spec                                        |    9 ++++-
 3 files changed, 78 insertions(+), 1 deletions(-)
---
diff --git a/0001-coverity-do-not-let-CDRDocument-parse-throw.patch b/0001-coverity-do-not-let-CDRDocument-parse-throw.patch
new file mode 100644
index 0000000..296a4c0
--- /dev/null
+++ b/0001-coverity-do-not-let-CDRDocument-parse-throw.patch
@@ -0,0 +1,35 @@
+From 625677ba4ec9f0b0bb930fcefab5b7fc91b9bae8 Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Thu, 13 Dec 2012 12:49:19 +0100
+Subject: [PATCH] coverity: do not let CDRDocument::parse throw
+
+---
+ src/lib/CDRDocument.cpp | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/src/lib/CDRDocument.cpp b/src/lib/CDRDocument.cpp
+index 4a75389..2633954 100644
+--- a/src/lib/CDRDocument.cpp
++++ b/src/lib/CDRDocument.cpp
+@@ -129,7 +129,17 @@ bool libcdr::CDRDocument::parse(::WPXInputStream *input, libwpg::WPGPaintInterfa
+ {
+   input->seek(0, WPX_SEEK_SET);
+   bool retVal = false;
+-  unsigned version = getCDRVersion(input);
++  unsigned version = 0;
++  try
++  {
++    version = getCDRVersion(input);
++  }
++  catch (libcdr::EndOfStreamException const&)
++  {
++    // This can only happen if isSupported() has not been called before
++    return false;
++  }
++
+   if (version)
+   {
+     input->seek(0, WPX_SEEK_SET);
+-- 
+1.8.0.1
+
diff --git a/0001-coverity-do-not-let-CMXDocument-isSupported-throw.patch b/0001-coverity-do-not-let-CMXDocument-isSupported-throw.patch
new file mode 100644
index 0000000..2efa669
--- /dev/null
+++ b/0001-coverity-do-not-let-CMXDocument-isSupported-throw.patch
@@ -0,0 +1,35 @@
+From c21b18b668b9efc0dc14257e1e43a85c1ccea807 Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Thu, 13 Dec 2012 12:13:14 +0100
+Subject: [PATCH] coverity: do not let CMXDocument::isSupported throw
+
+---
+ src/lib/CMXDocument.cpp | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/lib/CMXDocument.cpp b/src/lib/CMXDocument.cpp
+index 35d361d..9845552 100644
+--- a/src/lib/CMXDocument.cpp
++++ b/src/lib/CMXDocument.cpp
+@@ -45,6 +45,7 @@ Analyzes the content of an input stream to see if it can be parsed
+ stream is a Corel Draw Document that libcdr is able to parse
+ */
+ bool libcdr::CMXDocument::isSupported(WPXInputStream *input)
++try
+ {
+   input->seek(0, WPX_SEEK_SET);
+   unsigned riff = readU32(input);
+@@ -62,6 +63,10 @@ bool libcdr::CMXDocument::isSupported(WPXInputStream *input)
+     return false;
+   return true;
+ }
++catch (...)
++{
++  return false;
++}
+ 
+ /**
+ Parses the input stream content. It will make callbacks to the functions provided by a
+-- 
+1.8.0.1
+
diff --git a/libcdr.spec b/libcdr.spec
index f6ea445..9ddd091 100644
--- a/libcdr.spec
+++ b/libcdr.spec
@@ -1,12 +1,14 @@
 Name: libcdr
 Version: 0.0.9
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: A library providing ability to interpret and import Corel Draw drawings
 
 Group: System Environment/Libraries
 License: GPLv2+ or LGPLv2+ or MPLv1.1
 URL: http://www.freedesktop.org/wiki/Software/libcdr
 Source: http://dev-www.libreoffice.org/src/%{name}-%{version}.tar.xz
+Patch0: 0001-coverity-do-not-let-CDRDocument-parse-throw.patch
+Patch1: 0001-coverity-do-not-let-CMXDocument-isSupported-throw.patch
 
 BuildRequires: doxygen
 BuildRequires: lcms2-devel
@@ -48,6 +50,8 @@ Currently supported: XHTML, raw.
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
 
 
 %build
@@ -95,6 +99,9 @@ rm -f %{buildroot}/%{_bindir}/cmx2*
 
 
 %changelog
+* Tue Jan 08 2013 David Tardon <dtardon at redhat.com> - 0.0.9-2
+- Resolves: rhbz#891082 libreoffice Impress constantly crashes
+
 * Mon Oct 08 2012 David Tardon <dtardon at redhat.com> - 0.0.9-1
 - new upstream release
 


More information about the scm-commits mailing list