diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-09-05 17:52:48 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-09-05 18:09:55 +0200 |
commit | 99987e325b931fcceea2e587255a01a8ae571191 (patch) | |
tree | 89eb799df0bfc298733bd5d90c8b55fab66147df /writerfilter | |
parent | 5a107d3fdc069fdf95b7ab9a24fd84accf4160ae (diff) |
writerfilter: fix out of bound array access in ST_Jc's "both" case
Change-Id: Ia9d5e0b8e0685fdf5a9bbcab6a0797af12073a53
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 20 | ||||
-rw-r--r-- | writerfilter/source/ooxml/model.xml | 4 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 18 |
4 files changed, 35 insertions, 10 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 8a4910e8915b..07d87f5cfe8b 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3279,7 +3279,8 @@ void DomainMapper::handleParaJustification(const sal_Int32 nIntValue, const ::bo nAdjust = style::ParagraphAdjust_BLOCK; aStringValue = "both"; break; - case 0: + case NS_ooxml::LN_Value_ST_Jc_left: + case NS_ooxml::LN_Value_ST_Jc_start: default: nAdjust = static_cast< sal_Int16 > (bExchangeLeftRight ? style::ParagraphAdjust_RIGHT : style::ParagraphAdjust_LEFT); break; diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index abd78b70c832..014af87a2713 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -1004,14 +1004,22 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) break; case NS_ooxml::LN_CT_Lvl_lvlJc: { - static const sal_Int16 aWWAlignments[ ] = + sal_Int16 nValue = 0; + switch (nIntValue) { - text::HoriOrientation::LEFT, - text::HoriOrientation::CENTER, - text::HoriOrientation::RIGHT - }; + case NS_ooxml::LN_Value_ST_Jc_left: + case NS_ooxml::LN_Value_ST_Jc_start: + nValue = text::HoriOrientation::LEFT; + break; + case 1: + nValue = text::HoriOrientation::CENTER; + break; + case 2: + nValue = text::HoriOrientation::RIGHT; + break; + } m_pCurrentDefinition->GetCurrentLevel( )->Insert( - PROP_ADJUST, uno::makeAny( aWWAlignments[ nIntValue ] ) ); + PROP_ADJUST, uno::makeAny( nValue ) ); writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); } break; diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 4790dbef57bd..b977f288f779 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -17130,9 +17130,9 @@ <attribute name="rightChars" tokenid="ooxml:CT_Ind_rightChars"/> </resource> <resource name="ST_Jc" resource="List"> - <value tokenid="0">left</value> + <value tokenid="ooxml:Value_ST_Jc_left">left</value> <value tokenid="2">right</value> - <value tokenid="0">start</value> + <value tokenid="ooxml:Value_ST_Jc_start">start</value> <value tokenid="1">center</value> <value tokenid="2">end</value> <value tokenid="3">both</value> diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 244176223045..66019b128e81 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2426,7 +2426,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) nParam = 3; break; case RTF_QL: - nParam = 0; + nParam = NS_ooxml::LN_Value_ST_Jc_left; break; case RTF_QR: nParam = 2; @@ -3385,8 +3385,24 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) switch (nKeyword) { case RTF_LEVELJC: + { nSprm = NS_ooxml::LN_CT_Lvl_lvlJc; + int nValue = 0; + switch (nParam) + { + case 0: + nValue = NS_ooxml::LN_Value_ST_Jc_left; + break; + case 1: + nValue = 1; // center + break; + case 2: + nValue = 2; // right + break; + } + pIntValue.reset(new RTFValue(nValue)); break; + } case RTF_LEVELNFC: nSprm = NS_ooxml::LN_CT_Lvl_numFmt; break; |