From b2d4bf12b5517d8c85f8bcfb039e8faa60979202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 8 Jun 2011 11:07:49 +0100 Subject: [PATCH] Resolves: rhbz#699909 crash in export of .doc in lcl_getField --- ...9909-crash-in-export-of-.doc-in-lcl_.patch | 99 +++++++++++++++++++ libreoffice.spec | 7 +- 2 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 0001-Resolves-rhbz-699909-crash-in-export-of-.doc-in-lcl_.patch diff --git a/0001-Resolves-rhbz-699909-crash-in-export-of-.doc-in-lcl_.patch b/0001-Resolves-rhbz-699909-crash-in-export-of-.doc-in-lcl_.patch new file mode 100644 index 0000000..6ff34c9 --- /dev/null +++ b/0001-Resolves-rhbz-699909-crash-in-export-of-.doc-in-lcl_.patch @@ -0,0 +1,99 @@ +From 65e841076a947bcf115526e609de78e6952332e7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Wed, 8 Jun 2011 11:05:37 +0100 +Subject: [PATCH] Resolves: rhbz#699909 crash in export of .doc in + lcl_getFieldId + +--- + sw/source/filter/ww8/wrtw8nds.cxx | 26 +++++++++++++++----------- + 1 files changed, 15 insertions(+), 11 deletions(-) + +diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx +index 114f4a6..183fe59 100644 +--- a/sw/source/filter/ww8/wrtw8nds.cxx ++++ b/sw/source/filter/ww8/wrtw8nds.cxx +@@ -121,7 +121,9 @@ using namespace nsFieldFlags; + static String lcl_getFieldCode( const IFieldmark* pFieldmark ) { + OSL_ENSURE(pFieldmark!=NULL, "where is my fieldmark???"); + +- if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ) { ++ if ( !pFieldmark) { ++ return String(); ++ } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ) { + return String::CreateFromAscii(" FORMTEXT "); + } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMDROPDOWN ) ) ) { + return String::CreateFromAscii(" FORMDROPDOWN "); +@@ -140,7 +142,9 @@ static String lcl_getFieldCode( const IFieldmark* pFieldmark ) { + + ww::eField lcl_getFieldId( const IFieldmark* pFieldmark ) { + OSL_ENSURE(pFieldmark!=NULL, "where is my fieldmark???"); +- if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ) { ++ if ( !pFieldmark ) { ++ return ww::eUNKNOWN; ++ } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ) { + return ww::eFORMTEXT; + } else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMDROPDOWN ) ) ) { + return ww::eFORMDROPDOWN; +@@ -1840,11 +1844,11 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) + ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition ); + OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" ); + +- if ( pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ) ++ if ( pFieldmark && pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ) + AppendBookmark( pFieldmark->GetName(), false ); + ww::eField eFieldId = lcl_getFieldId( pFieldmark ); + String sCode = lcl_getFieldCode( pFieldmark ); +- if ( pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_UNHANDLED ) ) ) ++ if ( pFieldmark && pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_UNHANDLED ) ) ) + { + IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_ID_PARAM )) ); +@@ -1865,13 +1869,13 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) + } + } + OutputField( NULL, eFieldId, sCode, WRITEFIELD_START | WRITEFIELD_CMD_START ); +- if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ) ++ if ( pFieldmark && pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ) + WriteFormData( *pFieldmark ); +- else if ( pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_HYPERLINK ) ) ) ++ else if ( pFieldmark && pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_HYPERLINK ) ) ) + WriteHyperlinkData( *pFieldmark ); + OutputField( NULL, lcl_getFieldId( pFieldmark ), String(), WRITEFIELD_CMD_END ); + +- if ( pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_UNHANDLED ) ) ) ++ if ( pFieldmark && pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_UNHANDLED ) ) ) + { + // Check for the presence of a linked OLE object + IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find( +@@ -1893,7 +1897,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) + OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDEND??" ); + + ww::eField eFieldId = lcl_getFieldId( pFieldmark ); +- if ( pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_UNHANDLED ) ) ) ++ if ( pFieldmark && pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_UNHANDLED ) ) ) + { + IFieldmark::parameter_map_t::const_iterator it = pFieldmark->GetParameters()->find( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ODF_ID_PARAM )) ); +@@ -1906,7 +1910,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) + } + + OutputField( NULL, eFieldId, String(), WRITEFIELD_CLOSE ); +- if ( pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ) ++ if ( pFieldmark && pFieldmark->GetFieldname().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMTEXT ) ) ) + AppendBookmark( pFieldmark->GetName(), false ); + } + else if ( ch == CH_TXT_ATR_FORMELEMENT ) +@@ -1915,8 +1919,8 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) + ::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition ); + OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" ); + +- bool isDropdownOrCheckbox = pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMDROPDOWN ) ) || +- pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMCHECKBOX ) ); ++ bool isDropdownOrCheckbox = pFieldmark && (pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMDROPDOWN ) ) || ++ pFieldmark->GetFieldname( ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ODF_FORMCHECKBOX ) )); + + if ( isDropdownOrCheckbox ) + AppendBookmark( pFieldmark->GetName(), 0 ); +-- +1.7.5.2 + diff --git a/libreoffice.spec b/libreoffice.spec index 1de8c2d..1a91558 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -19,7 +19,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: 3.4.0.2 -Release: 4%{?dist} +Release: 5%{?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 @@ -96,6 +96,7 @@ Patch17: 0001-Resolves-rhbz-707317-avoid-crash-in-getRowSpan.patch Patch18: 0001-Resolves-rhbz-710004-band-aid-for-immediate-crash-in.patch Patch19: 0001-Resolves-rhbz-710556-don-t-crash-on-missing-graphics.patch Patch20: 0001-Related-rhbz-652604-better-survive-exceptions-thrown.patch +Patch21: 0001-Resolves-rhbz-699909-crash-in-export-of-.doc-in-lcl_.patch %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %define instdir %{_libdir} @@ -717,6 +718,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc %patch18 -p1 -b .rhbz710004-band-aid-for-immediate-crash-in.patch %patch19 -p1 -b .rhbz710556-don-t-crash-on-missing-graphics.patch %patch20 -p1 -b .rhbz652604-better-survive-exceptions-thrown.patch +%patch21 -p1 -b .rhbz699909-crash-in-export-of-.doc-in-lcl_.patch # these are horribly incomplete--empty translations and copied english # strings with spattering of translated strings @@ -1996,6 +1998,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %{basisinstdir}/program/kde-open-url %changelog +* Wed Jun 08 2011 Caolán McNamara - 3.4.0.2-5 +- Resolves: rhbz#699909 crash in export of .doc in lcl_getField + * Tue Jun 07 2011 Caolán McNamara - 3.4.0.2-4 - Resolves: rhbz#710556 't crash on missing graphics .pptx export - Resolves: rhbz#652604 better survive exceptions in autorecovery