writerfilter/source/dmapper/DomainMapper.cxx     |    3 ++-
 writerfilter/source/dmapper/NumberingManager.cxx |   20 ++++++++++++++------
 writerfilter/source/ooxml/model.xml              |    4 ++--
 writerfilter/source/rtftok/rtfdocumentimpl.cxx   |   18 +++++++++++++++++-
 4 files changed, 35 insertions(+), 10 deletions(-)

New commits:
commit 99987e325b931fcceea2e587255a01a8ae571191
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Fri Sep 5 17:52:48 2014 +0200

    writerfilter: fix out of bound array access in ST_Jc's "both" case
    
    Change-Id: Ia9d5e0b8e0685fdf5a9bbcab6a0797af12073a53

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 8a4910e..07d87f5 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 abd78b7..014af87 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 4790dbe..b977f28 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 2441762..66019b1 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;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to