diff options
author | Eike Rathke <erack@redhat.com> | 2012-08-01 13:46:25 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-08-01 13:29:21 +0100 |
commit | 9229d932de3bd406c58246293f7a12a88e19861c (patch) | |
tree | 75ef558012d5dc2a2e3b8028ba24e936845291a4 /sc/source/ui | |
parent | c921fc0ae2b20de1953e7558fce6b9ddb94c56d3 (diff) |
resolved fdo#53012 crash in CSV fixed width import
8cd05e9cf1152b21528c6f1a5bda3d949dc49791 changed from using String to
OUString. ScCsvGrid::ImplSetTextLineFix() attempted to copy excess
characters (always CSV_MAXSTRLEN if greater than field width) where
String::Copy() silently ignored the excess length but OUString::copy()
may result in invalid memory accesses and asserts in dbgutil build.
Change-Id: Ic9f7f38d6f2bbd770d6356e1304de8e39c09e30b
Signed-off-by: Michael Meeks <michael.meeks@suse.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/dbgui/csvgrid.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index 68c6fd9dca38..280d77e43821 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -809,7 +809,8 @@ void ScCsvGrid::ImplSetTextLineFix( sal_Int32 nLine, const rtl::OUString& rTextL for( sal_uInt32 nColIx = 0; (nColIx < nColCount) && (nStrIx < nStrLen); ++nColIx ) { sal_Int32 nColWidth = GetColumnWidth( nColIx ); - rStrVec.push_back( rTextLine.copy( nStrIx, Max( nColWidth, static_cast<sal_Int32>(CSV_MAXSTRLEN) ) ) ); + sal_Int32 nLen = std::min( std::min( nColWidth, static_cast<sal_Int32>(CSV_MAXSTRLEN) ), nStrLen - nStrIx); + rStrVec.push_back( rTextLine.copy( nStrIx, nLen ) ); nStrIx = nStrIx + nColWidth; } InvalidateGfx(); |