Resolves: rhbz#710556 't crash on missing graphics .pptx export

f41
Caolán McNamara 14 years ago
parent 3f404e25ba
commit 85eb1dd584

@ -0,0 +1,111 @@
From b883b506e2d4dca419838b56915c58a0030d5b98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Tue, 7 Jun 2011 12:37:08 +0100
Subject: [PATCH] Resolves: rhbz#710556 don't crash on missing graphics
---
oox/source/export/drawingml.cxx | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 4e94e90..7cf8d98 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -469,7 +469,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
{
GfxLink aLink = rGraphic.GetLink ();
OUString sMediaType;
- const char* sExtension = NULL;
+ const char* pExtension = "";
OUString sRelId;
SvMemoryStream aStream;
@@ -479,42 +479,42 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
switch ( aLink.GetType() ) {
case GFX_LINK_TYPE_NATIVE_GIF:
sMediaType = US( "image/gif" );
- sExtension = ".gif";
+ pExtension = ".gif";
break;
case GFX_LINK_TYPE_NATIVE_JPG:
sMediaType = US( "image/jpeg" );
- sExtension = ".jpeg";
+ pExtension = ".jpeg";
break;
case GFX_LINK_TYPE_NATIVE_PNG:
sMediaType = US( "image/png" );
- sExtension = ".png";
+ pExtension = ".png";
break;
case GFX_LINK_TYPE_NATIVE_TIF:
sMediaType = US( "image/tiff" );
- sExtension = ".tiff";
+ pExtension = ".tiff";
break;
case GFX_LINK_TYPE_NATIVE_WMF:
sMediaType = US( "image/x-wmf" );
- sExtension = ".wmf";
+ pExtension = ".wmf";
break;
case GFX_LINK_TYPE_NATIVE_MET:
sMediaType = US( "image/x-met" );
- sExtension = ".met";
+ pExtension = ".met";
break;
case GFX_LINK_TYPE_NATIVE_PCT:
sMediaType = US( "image/x-pict" );
- sExtension = ".pct";
+ pExtension = ".pct";
break;
default: {
GraphicType aType = rGraphic.GetType();
if ( aType == GRAPHIC_BITMAP ) {
GraphicConverter::Export( aStream, rGraphic, CVT_PNG );
sMediaType = US( "image/png" );
- sExtension = ".png";
+ pExtension = ".png";
} else if ( aType == GRAPHIC_GDIMETAFILE ) {
GraphicConverter::Export( aStream, rGraphic, CVT_EMF );
sMediaType = US( "image/x-emf" );
- sExtension = ".emf";
+ pExtension = ".emf";
} else {
OSL_TRACE( "unhandled graphic type" );
break;
@@ -526,7 +526,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
}
}
- const char *pComponent = NULL;
+ const char *pComponent = "";
switch ( meDocumentType )
{
case DOCUMENT_DOCX: pComponent = "word"; break;
@@ -538,13 +538,13 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
.appendAscii( pComponent )
.appendAscii( "/media/image" )
.append( (sal_Int32) mnImageCounter )
- .appendAscii( sExtension )
+ .appendAscii( pExtension )
.makeStringAndClear(),
sMediaType );
xOutStream->writeBytes( Sequence< sal_Int8 >( (const sal_Int8*) aData, nDataSize ) );
xOutStream->closeOutput();
- const char *pImagePrefix = NULL;
+ const char *pImagePrefix = "";
switch ( meDocumentType )
{
case DOCUMENT_DOCX:
@@ -561,7 +561,7 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
OUStringBuffer()
.appendAscii( pImagePrefix )
.append( (sal_Int32) mnImageCounter ++ )
- .appendAscii( sExtension )
+ .appendAscii( pExtension )
.makeStringAndClear() );
return sRelId;
--
1.7.5.2

@ -19,7 +19,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: 3.4.0.2
Release: 3%{?dist}
Release: 4%{?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
@ -94,6 +94,7 @@ Patch15: 0001-rhbz-702635-set-correct-page-number-when-exporting-s.patch
Patch16: 0001-handle-NULL-display-gracefully.patch
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
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%define instdir %{_libdir}
@ -713,6 +714,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
%patch16 -p1 -b .handle-NULL-display-gracefully.patch
%patch17 -p1 -b .rhbz707317-avoid-crash-in-getRowSpan.patch
%patch18 -p1 -b .rhbz710004-band-aid-for-immediate-crash-in.patch
%patch19 -p1 -b .rhbz710556-don-t-crash-on-missing-graphics.patch
# these are horribly incomplete--empty translations and copied english
# strings with spattering of translated strings
@ -1992,6 +1994,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%{basisinstdir}/program/kde-open-url
%changelog
* Tue Jun 07 2011 Caolán McNamara <caolanm@redhat.com> - 3.4.0.2-4
- Resolves: rhbz#710556 't crash on missing graphics .pptx export
* Thu Jun 02 2011 Caolán McNamara <caolanm@redhat.com> - 3.4.0.2-3
- Resolves: rhbz#710004 band aid for crash

Loading…
Cancel
Save