summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-04-03 17:04:32 +0200
committerLuboš Luňák <l.lunak@suse.cz>2013-04-04 11:51:46 +0000
commitdea93b72779747f7a10ecd9681232eb0f0de5d03 (patch)
tree5eeb72671c07d3cf53ccde1147f176bd15d03a1e /writerfilter
parent2deecc716a361d34f252e61f0196a01227411c09 (diff)
fdo#51916 don't try to support nested tables having table styles for now
Also fix an out of bounds substring access, triggered by the same bugdoc. (cherry picked from commits 7a7d77f97b61ae7f602ed403ecfbbcdb03a06c00, 7006ef460bb68d27a74381fab7b8826b786b31c6 and 008275d56f9ac5248f0e94f606671b4c1993ca20) Change-Id: I7db46ef17b8aed443faa7eb0c13b6ba109242cc1 Reviewed-on: https://gerrit.libreoffice.org/3199 Reviewed-by: Luboš Luňák <l.lunak@suse.cz> Tested-by: Luboš Luňák <l.lunak@suse.cz>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx21
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx3
2 files changed, 19 insertions, 5 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 7969b98eb16c..954c08f7e67f 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1294,7 +1294,11 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
m_aStates.top().nDestinationState = DESTINATION_SKIP;
break;
case RTF_NESTTABLEPROPS:
- m_aStates.top().nDestinationState = DESTINATION_NESTEDTABLEPROPERTIES;
+ // Don't try to support nested tables having table styles for now.
+ if (!m_aStates.top().bHasTableStyle)
+ m_aStates.top().nDestinationState = DESTINATION_NESTEDTABLEPROPERTIES;
+ else
+ m_aStates.top().nDestinationState = DESTINATION_SKIP;
break;
case RTF_HEADER:
case RTF_FOOTER:
@@ -3444,6 +3448,9 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
m_aStates.top().aCharacterAttributes.set(NS_rtf::LN_WR, RTFValue::Pointer_t(new RTFValue(3)));
}
break;
+ case RTF_TS:
+ m_aStates.top().bHasTableStyle = true;
+ break;
default:
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle value '" << lcl_RtfToString(nKeyword) << "'");
aSkip.setParsed(false);
@@ -3813,11 +3820,14 @@ int RTFDocumentImpl::popState()
// extract default text
nLength = aStr.toChar();
aStr = aStr.copy(1);
- OString aDefaultText = aStr.copy(0, nLength);
RTFValue::Pointer_t pNValue(new RTFValue(OStringToOUString(aName, m_aStates.top().nCurrentEncoding)));
m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pNValue);
- RTFValue::Pointer_t pDValue(new RTFValue(OStringToOUString(aDefaultText, m_aStates.top().nCurrentEncoding)));
- m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue);
+ if (nLength > 0)
+ {
+ OString aDefaultText = aStr.copy(0, nLength);
+ RTFValue::Pointer_t pDValue(new RTFValue(OStringToOUString(aDefaultText, m_aStates.top().nCurrentEncoding)));
+ m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue);
+ }
m_bFormField = false;
}
@@ -4407,7 +4417,8 @@ RTFParserState::RTFParserState(RTFDocumentImpl *pDocumentImpl)
nHour(0),
nMinute(0),
nCurrentStyleIndex(-1),
- pCurrentBuffer(0)
+ pCurrentBuffer(0),
+ bHasTableStyle(false)
{
}
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index e3b84020b398..0e0c4672c0d8 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -411,6 +411,9 @@ namespace writerfilter {
/// Points to the active buffer, if there is one.
RTFBuffer_t* pCurrentBuffer;
+
+ /// If a table style was requested to be used.
+ bool bHasTableStyle;
};
class RTFTokenizer;