[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - cui/source

Caolán McNamara caolanm at redhat.com
Wed Apr 2 08:45:22 PDT 2014


 cui/source/tabpages/chardlg.cxx |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

New commits:
commit 63dd47aed73a502bfbf3b490bd8b9f26528fdfc0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Apr 2 15:18:05 2014 +0100

    Resolves: fdo#75307 discard invalid user data
    
    Change-Id: Id39b51c344004e02d3d5a281ba98721b944468c3
    (cherry picked from commit f5b9db43080658201caf07cd646bae4f4f2acc95)
    Reviewed-on: https://gerrit.libreoffice.org/8815
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 3e6807c..28222fa 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -2897,6 +2897,26 @@ void SvxCharPositionPage::Reset( const SfxItemSet& rSet )
         m_nSubEsc = (short)sUser.getToken( 1, ';' ).toInt32();
         m_nSuperProp = (sal_uInt8)sUser.getToken( 2, ';' ).toInt32();
         m_nSubProp = (sal_uInt8)sUser.getToken( 3, ';' ).toInt32();
+
+        //fdo#75307 validate all the entries and discard all of them if any are
+        //out of range
+        bool bValid = true;
+        if (m_nSuperEsc < m_pHighLowMF->GetMin() || m_nSuperEsc > m_pHighLowMF->GetMax())
+            bValid = false;
+        if (m_nSubEsc*-1 < m_pHighLowMF->GetMin() || m_nSubEsc*-1 > m_pHighLowMF->GetMax())
+            bValid = false;
+        if (m_nSuperProp < m_pFontSizeMF->GetMin() || m_nSuperProp > m_pFontSizeMF->GetMax())
+            bValid = false;
+        if (m_nSubProp < m_pFontSizeMF->GetMin() || m_nSubProp > m_pFontSizeMF->GetMax())
+            bValid = false;
+
+        if (!bValid)
+        {
+            m_nSuperEsc = DFLT_ESC_SUPER;
+            m_nSubEsc = DFLT_ESC_SUB;
+            m_nSuperProp = DFLT_ESC_PROP;
+            m_nSubProp = DFLT_ESC_PROP;
+        }
     }
 
     short nEsc = 0;


More information about the Libreoffice-commits mailing list