summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2014-01-23 17:12:35 +0100
committerFridrich Štrba <fridrich.strba@bluewin.ch>2014-01-23 17:13:16 +0100
commit6f52d472393e4d92c0a4d988f28312edaeb5775c (patch)
treec74c036c6d83d375a768610700656ab6201138cc /external
parentd9d28895f7fcf1b05b77507e32f6aba1d5ef4305 (diff)
Don't crash on unstarted table
Change-Id: I68e596ea37133c89206333e8ca8aa3602878d2fc
Diffstat (limited to 'external')
-rw-r--r--external/libabw/UnpackedTarball_libabw.mk1
-rw-r--r--external/libabw/libabw-0.0.1-badtable.patch.1100
2 files changed, 101 insertions, 0 deletions
diff --git a/external/libabw/UnpackedTarball_libabw.mk b/external/libabw/UnpackedTarball_libabw.mk
index 4f8b44002efa..8e28755976c6 100644
--- a/external/libabw/UnpackedTarball_libabw.mk
+++ b/external/libabw/UnpackedTarball_libabw.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,libabw,$(ABW_TARBALL)))
$(eval $(call gb_UnpackedTarball_add_patches,libabw,\
external/libabw/libabw-0.0.1-inttypes.patch.1 \
external/libabw/libabw-0.0.1-stdstringfromnull.patch.1 \
+ external/libabw/libabw-0.0.1-badtable.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/libabw/libabw-0.0.1-badtable.patch.1 b/external/libabw/libabw-0.0.1-badtable.patch.1
new file mode 100644
index 000000000000..ddb0c8f43608
--- /dev/null
+++ b/external/libabw/libabw-0.0.1-badtable.patch.1
@@ -0,0 +1,100 @@
+--- a/src/lib/ABWContentCollector.cpp
++++ b/src/lib/ABWContentCollector.cpp
+@@ -1492,26 +1492,32 @@ void libabw::ABWContentCollector::closeTable()
+
+ void libabw::ABWContentCollector::openCell(const char *props)
+ {
+- if (props)
+- parsePropString(props, m_ps->m_tableStates.top().m_currentCellProperties);
+- int currentRow(0);
+- if (!findInt(_findCellProperty("top-attach"), currentRow))
+- currentRow = m_ps->m_tableStates.top().m_currentTableRow + 1;
+- while (m_ps->m_tableStates.top().m_currentTableRow < currentRow)
++ if (!m_ps->m_tableStates.empty())
+ {
+- if (m_ps->m_tableStates.top().m_currentTableRow >= 0)
+- _closeTableRow();
+- _openTableRow();
+- }
++ if (props)
++ parsePropString(props, m_ps->m_tableStates.top().m_currentCellProperties);
++ int currentRow(0);
++ if (!findInt(_findCellProperty("top-attach"), currentRow))
++ currentRow = m_ps->m_tableStates.top().m_currentTableRow + 1;
++ while (m_ps->m_tableStates.top().m_currentTableRow < currentRow)
++ {
++ if (m_ps->m_tableStates.top().m_currentTableRow >= 0)
++ _closeTableRow();
++ _openTableRow();
++ }
+
+- if (!findInt(_findCellProperty("left-attach"), m_ps->m_tableStates.top().m_currentTableCol))
+- m_ps->m_tableStates.top().m_currentTableCol++;
++ if (!findInt(_findCellProperty("left-attach"), m_ps->m_tableStates.top().m_currentTableCol))
++ m_ps->m_tableStates.top().m_currentTableCol++;
++ }
+ }
+
+ void libabw::ABWContentCollector::closeCell()
+ {
+- _closeTableCell();
+- m_ps->m_tableStates.top().m_currentCellProperties.clear();
++ if (!m_ps->m_tableStates.empty())
++ {
++ _closeTableCell();
++ m_ps->m_tableStates.top().m_currentCellProperties.clear();
++ }
+ }
+
+ void libabw::ABWContentCollector::collectData(const char *, const char *, const WPXBinaryData &)
+--- a/src/lib/ABWStylesCollector.cpp
++++ b/src/lib/ABWStylesCollector.cpp
+@@ -167,28 +167,32 @@ void libabw::ABWStylesCollector::closeTable()
+
+ void libabw::ABWStylesCollector::openCell(const char *props)
+ {
+- if (props)
+- parsePropString(props, m_ps->m_tableStates.top().m_currentCellProperties);
+- int currentRow(0);
+- if (!findInt(_findCellProperty("top-attach"), currentRow))
+- currentRow = m_ps->m_tableStates.top().m_currentTableRow + 1;
+- while (m_ps->m_tableStates.top().m_currentTableRow < currentRow)
+- m_ps->m_tableStates.top().m_currentTableRow++;
+-
+- if (!m_ps->m_tableStates.empty() && 0 == m_ps->m_tableStates.top().m_currentTableRow)
++ if (!m_ps->m_tableStates.empty())
+ {
+- int leftAttach(0);
+- int rightAttach(0);
+- if (findInt(_findCellProperty("left-attach"), leftAttach) && findInt(_findCellProperty("right-attach"), rightAttach))
+- m_ps->m_tableStates.top().m_currentTableWidth += rightAttach - leftAttach;
+- else
+- m_ps->m_tableStates.top().m_currentTableWidth++;
++ if (props)
++ parsePropString(props, m_ps->m_tableStates.top().m_currentCellProperties);
++ int currentRow(0);
++ if (!findInt(_findCellProperty("top-attach"), currentRow))
++ currentRow = m_ps->m_tableStates.top().m_currentTableRow + 1;
++ while (m_ps->m_tableStates.top().m_currentTableRow < currentRow)
++ m_ps->m_tableStates.top().m_currentTableRow++;
++
++ if (0 == m_ps->m_tableStates.top().m_currentTableRow)
++ {
++ int leftAttach(0);
++ int rightAttach(0);
++ if (findInt(_findCellProperty("left-attach"), leftAttach) && findInt(_findCellProperty("right-attach"), rightAttach))
++ m_ps->m_tableStates.top().m_currentTableWidth += rightAttach - leftAttach;
++ else
++ m_ps->m_tableStates.top().m_currentTableWidth++;
++ }
+ }
+ }
+
+ void libabw::ABWStylesCollector::closeCell()
+ {
+- m_ps->m_tableStates.top().m_currentCellProperties.clear();
++ if (!m_ps->m_tableStates.empty())
++ m_ps->m_tableStates.top().m_currentCellProperties.clear();
+ }
+
+ std::string libabw::ABWStylesCollector::_findCellProperty(const char *name)