summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-09-02 20:05:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-04 08:17:06 +0200
commitd4dc6b5cfdb02ad00a06ad32650948648abe010d (patch)
tree02446cd93e68aba9b78db6eb7fc902e782c6faf9 /emfio
parent86fa9c907387e96c9c93f1e17239730271fedbfd (diff)
use std::vector for fetching DX array data
because I'm trying to track down a related heap corruption, and that is much easier if the access to the array is checked by the std::vector debug runtime Change-Id: Ia665f5cebb7f14d88942e88b4b400ad3c28ef5d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121527 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'emfio')
-rw-r--r--emfio/source/reader/mtftools.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index aaefec7eb6e4..07143b8168af 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1869,6 +1869,7 @@ namespace emfio
/* because text without dx array is badly scaled, we
will create such an array if necessary */
tools::Long* pDX = pDXArry;
+ std::vector<tools::Long> aMyDXArray;
if (pDXArry)
{
// only useful when we have an imported DXArray
@@ -1885,14 +1886,12 @@ namespace emfio
// #i117968# VirtualDevice is not thread safe, but filter is used in multithreading
SolarMutexGuard aGuard;
ScopedVclPtrInstance< VirtualDevice > pVDev;
- pDX = new tools::Long[ rText.getLength() ];
pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
pVDev->SetFont( maLatestFont );
- pVDev->GetTextArray( rText, pDX, 0, rText.getLength());
+ pVDev->GetTextArray( rText, &aMyDXArray, 0, rText.getLength());
+ pDX = aMyDXArray.data();
}
mpGDIMetaFile->AddAction( new MetaTextArrayAction( rPosition, rText, pDX, 0, rText.getLength() ) );
- if ( !pDXArry ) // this means we have created our own array
- delete[] pDX; // which must be deleted
}
}
SetGfxMode( nOldGfxMode );