Resolves: rhbz#1643752 crash in specific wpd file

This commit is contained in:
Caolán McNamara 2018-10-30 11:04:20 +00:00
parent 4c855def68
commit e42834b844
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,29 @@
diff -ru libwpd-0.10.2/src/lib/WP6ContentListener.cpp libwpd-0.10.2.new/src/lib/WP6ContentListener.cpp
--- libwpd-0.10.2/src/lib/WP6ContentListener.cpp 2017-09-08 18:04:25.000000000 +0100
+++ libwpd-0.10.2.new/src/lib/WP6ContentListener.cpp 2018-10-30 10:54:22.326697162 +0000
@@ -1311,7 +1311,10 @@
m_ps->m_tableDefinition.m_columnsProperties.clear();
// pull a table definition off of our stack
- m_parseState->m_currentTable = m_parseState->m_tableList[m_parseState->m_nextTableIndice++];
+ auto index = m_parseState->m_nextTableIndice++;
+ if (index >= m_parseState->m_tableList.size())
+ throw ParseException();
+ m_parseState->m_currentTable = m_parseState->m_tableList[index];
if (!m_parseState->m_currentTable)
throw ParseException();
m_parseState->m_currentTable->makeBordersConsistent();
diff -ru libwpd-0.10.2/src/lib/WPXTable.h libwpd-0.10.2.new/src/lib/WPXTable.h
--- libwpd-0.10.2/src/lib/WPXTable.h 2015-12-30 08:27:30.000000000 +0000
+++ libwpd-0.10.2.new/src/lib/WPXTable.h 2018-10-30 10:55:41.264362182 +0000
@@ -92,6 +92,10 @@
{
m_tableList->push_back(table);
}
+ size_t size() const
+ {
+ return m_tableList->size();
+ }
private:
void release();

View File

@ -3,7 +3,7 @@
Name: libwpd
Summary: A library for import of WordPerfect documents
Version: 0.10.2
Release: 3%{?dist}
Release: 4%{?dist}
Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz
URL: http://libwpd.sf.net/
License: LGPLv2+ or MPLv2.0
@ -17,6 +17,8 @@ BuildRequires: pkgconfig(librevenge-generators-0.0)
BuildRequires: pkgconfig(librevenge-stream-0.0)
BuildRequires: pkgconfig(zlib)
Patch0: 0001-Resolves-rhbz-1643752-bounds-check-m_currentTable-ac.patch
%description
%{name} is a library for import of WordPerfect documents.
@ -94,6 +96,9 @@ install -m 0644 wpd2*.1 %{buildroot}/%{_mandir}/man1
%doc docs/%{name}.png
%changelog
* Tue Oct 30 2018 Caolán McNamara <caolanm@redhat.com> - 0.10.2-4
- Resolves: rhbz#1643752 crash in specific wpd file
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild