[Libreoffice-commits] .: sw/source
Michael Stahl
mst at kemper.freedesktop.org
Fri Aug 10 15:13:43 PDT 2012
sw/source/filter/ascii/parasc.cxx | 2 +-
sw/source/filter/basflt/iodetect.cxx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 7d8cd0abb8e4b1b891e982d10f57de108aaca1ea
Author: Michael Stahl <mstahl at redhat.com>
Date: Sat Aug 11 00:01:20 2012 +0200
fdo#53328: sw: ascii import: fix crash:
The aWork buffer is missing space for the null terminator, which the
previous String::AllocateBuffer automatically added.
(regression from aac04652fda01b0299e17087b151f07d6115e894)
Change-Id: Ia12ad46dfb95dd59965a073debb95b241b2e97d9
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index ec68e01..4d53a8f 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -331,7 +331,7 @@ sal_uLong SwASCIIParser::ReadChars()
{
sal_uInt32 nInfo;
sal_Size nNewLen = lGCount, nCntBytes;
- aWork.reset(new sal_Unicode[nNewLen]);
+ aWork.reset(new sal_Unicode[nNewLen + 1]); // add 1 for '\0'
sal_Unicode* pBuf = aWork.get();
nNewLen = rtl_convertTextToUnicode( hConverter, hContext,
diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx
index 88c26d7..af3cd97 100644
--- a/sw/source/filter/basflt/iodetect.cxx
+++ b/sw/source/filter/basflt/iodetect.cxx
@@ -450,7 +450,7 @@ bool SwIoSystem::IsDetectableText(const sal_Char* pBuf, sal_uLong &rLen,
if (eCharSet != RTL_TEXTENCODING_DONTKNOW)
{
- boost::scoped_array<sal_Unicode> aWork(new sal_Unicode[rLen]);
+ boost::scoped_array<sal_Unicode> aWork(new sal_Unicode[rLen+1]);
sal_Unicode *pNewBuf = aWork.get();
sal_Size nNewLen;
if (eCharSet != RTL_TEXTENCODING_UCS2)
More information about the Libreoffice-commits
mailing list