[ooo-build-commit] Branch 'ooo-build-3-1-1' - patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Oct 5 12:48:17 PDT 2009


 patches/dev300/apply                                       |    3 
 patches/dev300/calc-xls-export-encryption-condfmt-fix.diff |   63 +++++++++++++
 2 files changed, 66 insertions(+)

New commits:
commit dbb2e06e642e1d4402c44569fea6d6a792eb88e4
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon Oct 5 15:44:04 2009 -0400

    Properly encrypt zero bytes inside conditional formatting records.
    
    * patches/dev300/apply:
    * patches/dev300/calc-xls-export-encryption-condfmt-fix.diff: writing
      raw zero bytes without encrypting them caused the saved xls document
      to crash certain versions of Excel upon opening it.  All versions of
      Excel up to Excel XP (without service packs) were affected.
      (n#541058)

diff --git a/patches/dev300/apply b/patches/dev300/apply
index bd960bc..c43d6d1 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3438,6 +3438,9 @@ calc-selection-protected-cells.diff, n#542024, kohei
 calc-general-type-auto-decimal-sc.diff,      n#541973, kohei
 calc-general-type-auto-decimal-svtools.diff, n#541973, kohei
 
+# Correctly encrypt zero bytes in the conditional formatting records.
+calc-xls-export-encryption-condfmt-fix.diff, n#541058, kohei
+
 [ AutoLayout ]
 sd-layoutcode.diff, cocofan
 offapi-layoutcode.diff, cocofan
diff --git a/patches/dev300/calc-xls-export-encryption-condfmt-fix.diff b/patches/dev300/calc-xls-export-encryption-condfmt-fix.diff
new file mode 100644
index 0000000..5f834e2
--- /dev/null
+++ b/patches/dev300/calc-xls-export-encryption-condfmt-fix.diff
@@ -0,0 +1,63 @@
+diff --git sc/source/filter/excel/xecontent.cxx sc/source/filter/excel/xecontent.cxx
+index ae987eb..4575fca 100644
+--- sc/source/filter/excel/xecontent.cxx
++++ sc/source/filter/excel/xecontent.cxx
+@@ -761,19 +761,19 @@ void XclExpCFImpl::WriteBody( XclExpStream& rStrm )
+             // font used flag for underline -> 0 = used, 1 = default
+             sal_uInt32 nFontFlags3 = mbUnderlUsed ? 0 : EXC_CF_FONT_UNDERL;
+ 
+-            rStrm.WriteZeroBytes( 64 );
++            rStrm.WriteZeroBytesToRecord( 64 );
+             rStrm   << nHeight
+                     << nStyle
+                     << maFontData.mnWeight
+                     << EXC_FONTESC_NONE
+                     << maFontData.mnUnderline;
+-            rStrm.WriteZeroBytes( 3 );
++            rStrm.WriteZeroBytesToRecord( 3 );
+             rStrm   << nColor
+                     << sal_uInt32( 0 )
+                     << nFontFlags1
+                     << EXC_CF_FONT_ESCAPEM      // escapement never used -> set the flag
+                     << nFontFlags3;
+-            rStrm.WriteZeroBytes( 16 );
++            rStrm.WriteZeroBytesToRecord( 16 );
+             rStrm   << sal_uInt16( 1 );         // must be 1
+         }
+ 
+diff --git sc/source/filter/excel/xestream.cxx sc/source/filter/excel/xestream.cxx
+index 0f8262c..2d10d80 100644
+--- sc/source/filter/excel/xestream.cxx
++++ sc/source/filter/excel/xestream.cxx
+@@ -258,6 +258,17 @@ void XclExpStream::WriteZeroBytes( sal_Size nBytes )
+         WriteRawZeroBytes( nBytes );
+ }
+ 
++void XclExpStream::WriteZeroBytesToRecord( sal_Size nBytes )
++{
++    if (!mbInRec)
++        // not in record.
++        return;
++
++    sal_uInt8 nZero = 0;
++    for (sal_Size i = 0; i < nBytes; ++i)
++        *this << nZero;
++}
++
+ sal_Size XclExpStream::CopyFromStream( SvStream& rInStrm, sal_Size nBytes )
+ {
+     sal_Size nStrmPos = rInStrm.Tell();
+diff --git sc/source/filter/inc/xestream.hxx sc/source/filter/inc/xestream.hxx
+index 84bf4ce..aaa56b2 100644
+--- sc/source/filter/inc/xestream.hxx
++++ sc/source/filter/inc/xestream.hxx
+@@ -126,6 +126,9 @@ public:
+     sal_Size            Write( const void* pData, sal_Size nBytes );
+     /** Writes a sequence of nBytes zero bytes (respects slice setting). */
+     void                WriteZeroBytes( sal_Size nBytes );
++
++    void                WriteZeroBytesToRecord( sal_Size nBytes );
++
+     /** Copies nBytes bytes from current position of the stream rInStrm.
+         @descr  Omitting the second parameter means: read to end of stream. */
+     sal_Size            CopyFromStream( SvStream& rInStrm, sal_Size nBytes = STREAM_SEEK_TO_END );


More information about the ooo-build-commit mailing list