[libreoffice] Fix up some doc imports

Caolan McNamara caolanm at fedoraproject.org
Wed Dec 15 13:30:05 UTC 2010


commit e778afd13c5e41ba57d52eed8f727ce3991b5f39
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Dec 15 13:29:56 2010 +0000

    Fix up some doc imports

 ...p-and-don-t-bail-out-on-mislength-records.patch |  209 ++++++++++++++++++++
 libreoffice.spec                                   |    7 +-
 2 files changed, 215 insertions(+), 1 deletions(-)
---
diff --git a/0001-tidy-this-up-and-don-t-bail-out-on-mislength-records.patch b/0001-tidy-this-up-and-don-t-bail-out-on-mislength-records.patch
new file mode 100644
index 0000000..b33daa4
--- /dev/null
+++ b/0001-tidy-this-up-and-don-t-bail-out-on-mislength-records.patch
@@ -0,0 +1,209 @@
+diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
+index 5720af2..7807371 100644
+--- a/sw/source/filter/ww8/ww8graf.cxx
++++ b/sw/source/filter/ww8/ww8graf.cxx
+@@ -1052,7 +1052,7 @@ SwFrmFmt* SwWW8ImplReader::InsertTxbxText(SdrTextObj* pTextObj,
+                                             Read_PicLoc(nAktId, pParams, 1);
+                                         break;
+                                 }
+-                                aSprmIter++;
++                                aSprmIter.advance();
+                             }
+ 
+                             if( !nLoop )
+diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
+index 5b66561..65172b1 100644
+--- a/sw/source/filter/ww8/ww8par2.cxx
++++ b/sw/source/filter/ww8/ww8par2.cxx
+@@ -1964,7 +1964,7 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP nStartCp) :
+                     default:
+                         ;
+                 }
+-                aSprmIter++;
++                aSprmIter.advance();
+             }
+ 
+             if( !nLoop )
+diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
+index f2c8fd6..44f1f69 100644
+--- a/sw/source/filter/ww8/ww8scan.cxx
++++ b/sw/source/filter/ww8/ww8scan.cxx
+@@ -895,22 +895,17 @@ void WW8SprmIter::SetSprms(const BYTE* pSprms_, long nLen_)
+     UpdateMyMembers();
+ }
+ 
+-const BYTE* WW8SprmIter::operator ++( int )
++void WW8SprmIter::advance()
+ {
+     if (nRemLen > 0 )
+     {
+-        if( nRemLen >= nAktSize )
+-        {
+-            pSprms += nAktSize;
+-            nRemLen -= nAktSize;
+-            UpdateMyMembers();
+-        }
+-        else
+-        {
+-            throw( ::std::exception() );
+-        }
++        USHORT nSize = nAktSize;
++        if (nSize > nRemLen)
++            nSize = nRemLen;
++        pSprms += nSize;
++        nRemLen -= nSize;
++        UpdateMyMembers();
+     }
+-    return pSprms;
+ }
+ 
+ void WW8SprmIter::UpdateMyMembers()
+@@ -936,7 +931,7 @@ const BYTE* WW8SprmIter::FindSprm(USHORT nId)
+     {
+         if( GetAktId() == nId )
+             return GetAktParams();              // SPRM found!
+-        operator ++(0);
++        advance();
+     }
+ 
+     return 0;                                   // SPRM _not_ found
+@@ -2828,7 +2823,7 @@ bool WW8PLCFx_Fc_FKP::WW8Fkp::HasSprm(USHORT nId,
+     {
+         if (aIter.GetAktId() == nId)
+             rResult.push_back(aIter.GetAktParams());
+-        aIter++;
++        aIter.advance();
+     };
+     return !rResult.empty();
+ }
+@@ -3151,7 +3146,7 @@ bool WW8PLCFx_Fc_FKP::HasSprm(USHORT nId, std::vector<const BYTE *> &rResult)
+         {
+             if (aIter.GetAktId() == nId)
+                 rResult.push_back(aIter.GetAktParams());
+-            aIter++;
++            aIter.advance();
+         };
+     }
+     return !rResult.empty();
+diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
+index cf6541f..af19986 100644
+--- a/sw/source/filter/ww8/ww8scan.hxx
++++ b/sw/source/filter/ww8/ww8scan.hxx
+@@ -261,7 +261,7 @@ public:
+         const wwSprmParser &rSprmParser);
+     void  SetSprms( const BYTE* pSprms_, long nLen_ );
+     const BYTE* FindSprm(USHORT nId);
+-    const BYTE*  operator ++( int );
++    void  advance();
+     const BYTE* GetSprms() const 
+         { return ( pSprms && (0 < nRemLen) ) ? pSprms : 0; }
+     const BYTE* GetAktParams() const { return pAktParams; }
+diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
+index 801cc2f..0df3331 100644
+--- a/sw/source/filter/ww8/ww8par.cxx
++++ b/sw/source/filter/ww8/ww8par.cxx
+@@ -3895,7 +3895,7 @@ void SwWW8ImplReader::ReadDocInfo()
+                         xDocProps->setTemplateURL( sTemplateURL );
+                 }
+             }
+-            else // not a template
++            else if (pWwFib->lcbSttbfAssoc) // not a template, and has a SttbfAssoc
+             {
+                 long nCur = pTableStream->Tell();
+                 Sttb aSttb;
+diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
+index 44f1f69..b1e0351 100644
+--- a/sw/source/filter/ww8/ww8scan.cxx
++++ b/sw/source/filter/ww8/ww8scan.cxx
+@@ -2561,6 +2561,7 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
+     long nOldPos = pSt->Tell();
+ 
+     pSt->Seek(nFilePos);
++    memset(maRawData, 0, 512);
+     pSt->Read(maRawData, 512);
+     mnIMax = maRawData[511];
+ 
+@@ -2605,24 +2606,36 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
+                             aEntry.mnLen = maRawData[nOfs+1];
+                             nDelta++;
+                         }
+-
+                         aEntry.mnLen *= 2;
+ 
+                         //stylecode, std/istd
+                         if (eVersion == ww::eWW2)
+                         {
+-                            aEntry.mnIStd = *(maRawData+nOfs+1+nDelta);
+-                            aEntry.mnLen--;  //style code
+-                            aEntry.mnLen-=6; //PHE
+-                            //skipi stc, len byte + 6 byte PHE
+-                            aEntry.mpData = maRawData + nOfs + 8;
++                            if (aEntry.mnLen >= 1)
++                            {
++                                aEntry.mnIStd = *(maRawData+nOfs+1+nDelta);
++                                aEntry.mnLen--;  //style code
++                                if (aEntry.mnLen >= 6)
++                                {
++                                    aEntry.mnLen-=6; //PHE
++                                    //skipi stc, len byte + 6 byte PHE
++                                    aEntry.mpData = maRawData + nOfs + 8;
++                                }
++                                else
++                                    aEntry.mnLen=0; //Too short
++                            }
+                         }
+                         else
+                         {
+-                            aEntry.mnIStd = SVBT16ToShort(maRawData+nOfs+1+nDelta);
+-                            aEntry.mnLen-=2; //istd
+-                            //skip istd, len byte + optional extra len byte
+-                            aEntry.mpData = maRawData + nOfs + 3 + nDelta;
++                            if (aEntry.mnLen >= 2)
++                            {
++                                aEntry.mnIStd = SVBT16ToShort(maRawData+nOfs+1+nDelta);
++                                aEntry.mnLen-=2; //istd
++                                //skip istd, len byte + optional extra len byte
++                                aEntry.mpData = maRawData + nOfs + 3 + nDelta;
++                            }
++                            else
++                                aEntry.mnLen=0; //Too short, ignore
+                         }
+ 
+                         USHORT nSpId = aEntry.mnLen ? maSprmParser.GetSprmId(aEntry.mpData) : 0;
+@@ -2666,6 +2679,17 @@ WW8PLCFx_Fc_FKP::WW8Fkp::WW8Fkp(ww::WordVersion eVersion, SvStream* pSt,
+         }
+ 
+         maEntries.push_back(aEntry);
++
++#ifdef DEBUGSPRMREADER
++        {
++            sal_Int32 nLen;
++            BYTE* pSprms = GetLenAndIStdAndSprms( nLen );
++
++            WW8SprmIter aIter(pSprms, nLen, maSprmParser);
++            while(aIter.GetSprms())
++                aIter.advance();
++        }
++#endif
+     }
+ 
+     //one more FC than grrpl entries
+diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx
+index 81b73e5..daee39b 100644
+--- a/filter/source/msfilter/mstoolbar.cxx
++++ b/filter/source/msfilter/mstoolbar.cxx
+@@ -188,10 +188,11 @@ TBBase::indent_printf( FILE* fp, const char* format, ... )
+ 
+ rtl::OUString TBBase::readUnicodeString( SvStream* pS, sal_Int32 nChars )
+ {
+-    sal_Int32 nBufSize = nChars * 2;
++    sal_Size nBufSize = nChars * 2;
+     boost::scoped_array< sal_uInt8 > pArray( new sal_uInt8[ nBufSize ] );
+-    pS->Read( pArray.get(), nBufSize );
+-    return svt::BinFilterUtils::CreateOUStringFromUniStringArray(  reinterpret_cast< const char* >( pArray.get() ), nBufSize );
++    sal_Size nReadSize = pS->Read( pArray.get(), nBufSize );
++    OSL_ASSERT(nReadSize == nBufSize);
++    return svt::BinFilterUtils::CreateOUStringFromUniStringArray(  reinterpret_cast< const char* >( pArray.get() ), nReadSize );
+ }
+ 
+ TBCHeader::TBCHeader() : bSignature( 0x3 )
diff --git a/libreoffice.spec b/libreoffice.spec
index a19a055..229bfed 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -28,7 +28,7 @@
 Summary:        Free Software Productivity Suite
 Name:           libreoffice
 Version:        3.3.0.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 License:        LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and (CDDL or GPLv2) and Public Domain
 Group:          Applications/Productivity
 URL:            http://www.documentfoundation.org/develop
@@ -93,6 +93,7 @@ Patch10: openoffice.org-3.3.0.ooo108637.sfx2.uisavedir.patch
 Patch11: openoffice.org-3.3.0.ooo113273.desktop.resolvelinks.patch
 Patch12: turn-script-providers-into-extensions.patch
 Patch13: libreoffice-installfix.patch
+Patch14: 0001-tidy-this-up-and-don-t-bail-out-on-mislength-records.patch
 
 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 %define instdir %{_libdir}
@@ -701,6 +702,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
 %patch11 -p0 -b .ooo113273.desktop.resolvelinks.patch
 %patch12 -p1 -b .turn-script-providers-into-extensions.patch
 %patch13 -p1 -b .libreoffice-installfix.patch
+%patch14 -p1 -b .don-t-bail-out-on-mislength-records.patch
 touch scripting/source/pyprov/delzip
 touch scripting/util/provider/beanshell/delzip
 touch scripting/util/provider/javascript/delzip
@@ -2007,6 +2009,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 %{basisinstdir}/share/registry/pyuno.xcd
 
 %changelog
+* Wed Dec 15 2010 Caolán McNamara <caolanm at redhat.com> 3.3.0.1-2
+- Fix up some doc imports
+
 * Sun Dec 05 2010 Caolán McNamara <caolanm at redhat.com> 3.3.0.1-1
 - release candidate 1
 - drop integrated qstart.dont-forceenabled-on-post-reg-restart.patch


More information about the scm-commits mailing list