[Libreoffice-commits] .: filter/source svx/inc

Caolán McNamara caolan at kemper.freedesktop.org
Sat Feb 4 05:58:26 PST 2012


 filter/source/msfilter/msdffimp.cxx |    6 +++---
 svx/inc/svx/msdffdef.hxx            |    3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 28a6558f9d3ca2dda3191f8b5b3f2378ee2533da
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Feb 4 01:17:03 2012 +0100

    extract max legal dff length to header

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 8f25ac8..5871da9 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3422,6 +3422,8 @@ bool SvxMSDffManager::SeekToRec( SvStream& rSt, sal_uInt16 nRecId, sal_uLong nMa
         rSt >> aHd;
         if (!rSt.good())
             break;
+        if (aHd.nRecLen > nMaxLegalDffRecordLength)
+            break;
         if ( aHd.nRecType == nRecId )
         {
             if ( nSkipCount )
@@ -6818,8 +6820,6 @@ bool SvxMSDffManager::ReadCommonRecordHeader(DffRecordHeader& rRec,
         rRec.nRecInstance, rRec.nRecType, rRec.nRecLen);
 }
 
-sal_uInt32 nMaxLegalRecordLength = SAL_MAX_UINT32 - DFF_COMMON_RECORD_HEADER_SIZE;
-
 /* also static */
 bool SvxMSDffManager::ReadCommonRecordHeader(SvStream& rSt,
     sal_uInt8& rVer, sal_uInt16& rInst, sal_uInt16& rFbt, sal_uInt32& rLength)
@@ -6830,7 +6830,7 @@ bool SvxMSDffManager::ReadCommonRecordHeader(SvStream& rSt,
     rInst = nTmp >> 4;
     if (!rSt.good())
         return false;
-    if (rLength > nMaxLegalRecordLength)
+    if (rLength > nMaxLegalDffRecordLength)
         return false;
     return true;
 }
diff --git a/svx/inc/svx/msdffdef.hxx b/svx/inc/svx/msdffdef.hxx
index 42acdbb..016197f 100644
--- a/svx/inc/svx/msdffdef.hxx
+++ b/svx/inc/svx/msdffdef.hxx
@@ -37,6 +37,9 @@
 
 #define DFF_COMMON_RECORD_HEADER_SIZE           8
 
+const sal_uInt32 nMaxLegalDffRecordLength = \
+    SAL_MAX_UINT32 - DFF_COMMON_RECORD_HEADER_SIZE;
+
 #define DFF_PSFLAG_CONTAINER 0x0F         // If the version field of a record
                                           //  header takes on this value, the
                                           //  record header marks the start of


More information about the Libreoffice-commits mailing list