dtardon pushed to libabw (master). "fix two potential crashes"

notifications at fedoraproject.org notifications at fedoraproject.org
Mon May 4 14:53:30 UTC 2015


>From 8a6526cc9eb26f76ba76ed8a33de7c8cde1e3aa1 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon at redhat.com>
Date: Mon, 4 May 2015 16:44:22 +0200
Subject: fix two potential crashes


diff --git a/0001-coverity-1259904-dereference-before-null-check.patch b/0001-coverity-1259904-dereference-before-null-check.patch
new file mode 100644
index 0000000..3ddc9a9
--- /dev/null
+++ b/0001-coverity-1259904-dereference-before-null-check.patch
@@ -0,0 +1,30 @@
+From a65eb81c5e9d9da0548eb9066f9dde77a7328cc3 Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Sat, 20 Dec 2014 18:35:36 +0100
+Subject: [PATCH] coverity#1259904 dereference before null check
+
+Change-Id: If53074b31a821b0764acc9e9f1b0f9d7894e2e5e
+---
+ src/lib/ABWParser.cpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/lib/ABWParser.cpp b/src/lib/ABWParser.cpp
+index cf914bf..426ab54 100644
+--- a/src/lib/ABWParser.cpp
++++ b/src/lib/ABWParser.cpp
+@@ -338,9 +338,11 @@ void libabw::ABWParser::readAbiword(xmlTextReaderPtr reader)
+ void libabw::ABWParser::readM(xmlTextReaderPtr reader)
+ {
+   xmlChar *const key = xmlTextReaderGetAttribute(reader, BAD_CAST("key"));
+-  m_state->m_currentMetadataKey = reinterpret_cast<const char *>(key);
+   if (key)
++  {
++    m_state->m_currentMetadataKey = reinterpret_cast<const char *>(key);
+     xmlFree(key);
++  }
+ }
+ 
+ void libabw::ABWParser::readHistory(xmlTextReaderPtr reader)
+-- 
+2.3.5
+
diff --git a/0001-coverity-1259905-do-not-let-AbiDocument-parse-throw.patch b/0001-coverity-1259905-do-not-let-AbiDocument-parse-throw.patch
new file mode 100644
index 0000000..656bee9
--- /dev/null
+++ b/0001-coverity-1259905-do-not-let-AbiDocument-parse-throw.patch
@@ -0,0 +1,38 @@
+From 2f372e8adf8e6b1f8cf70f08adddcf66be54d94a Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Sat, 20 Dec 2014 18:40:45 +0100
+Subject: [PATCH] coverity#1259905 do not let AbiDocument::parse throw
+
+This also fixes coverity#1259906 and coverity#1259907 .
+
+Change-Id: I55d892517ac93ca43478d51d8e4a20c704ff6790
+---
+ src/lib/AbiDocument.cpp | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/src/lib/AbiDocument.cpp b/src/lib/AbiDocument.cpp
+index b8ab661..23ff750 100644
+--- a/src/lib/AbiDocument.cpp
++++ b/src/lib/AbiDocument.cpp
+@@ -110,7 +110,7 @@ is not protected
+ \return A value that indicates whether the conversion was successful and in case it
+ was not, it indicates the reason of the error
+ */
+-ABWAPI bool libabw::AbiDocument::parse(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *textInterface)
++ABWAPI bool libabw::AbiDocument::parse(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *textInterface) try
+ {
+   ABW_DEBUG_MSG(("AbiDocument::parse\n"));
+   if (!input)
+@@ -122,4 +122,9 @@ ABWAPI bool libabw::AbiDocument::parse(librevenge::RVNGInputStream *input, libre
+     return true;
+   return false;
+ }
++catch (...)
++{
++  return false;
++}
++
+ /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
+-- 
+2.3.5
+
diff --git a/libabw.spec b/libabw.spec
index 120b107..f97e16f 100644
--- a/libabw.spec
+++ b/libabw.spec
@@ -2,7 +2,7 @@
 
 Name: libabw
 Version: 0.1.1
-Release: 3%{?dist}
+Release: 4%{?dist}
 Summary: A library for import of AbiWord files
 
 License: MPLv2.0
@@ -16,6 +16,9 @@ BuildRequires: help2man
 BuildRequires: pkgconfig(librevenge-0.0)
 BuildRequires: pkgconfig(libxml-2.0)
 
+Patch0: 0001-coverity-1259904-dereference-before-null-check.patch
+Patch1: 0001-coverity-1259905-do-not-let-AbiDocument-parse-throw.patch
+
 %description
 %{name} is a library for import of AbiWord files.
 
@@ -43,7 +46,7 @@ Tools to transform AbiWord files into other formats. Currently
 supported: XHTML, raw, text.
 
 %prep
-%setup -q
+%autosetup -p1
 
 %build
 %configure --disable-silent-rules --disable-static --disable-werror
@@ -94,6 +97,9 @@ install -m 0644 abw2*.1 %{buildroot}/%{_mandir}/man1
 %{_mandir}/man1/abw2html.1*
 
 %changelog
+* Mon May 04 2015 David Tardon <dtardon at redhat.com> - 0.1.1-4
+- fix two potential crashes
+
 * Sat May 02 2015 Kalev Lember <kalevlember at gmail.com> - 0.1.1-3
 - Rebuilt for GCC 5 C++11 ABI change
 
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/libabw.git/commit/?h=master&id=8a6526cc9eb26f76ba76ed8a33de7c8cde1e3aa1


More information about the scm-commits mailing list