From 2d4ccc58e9ef3b98a88407e1a7a3abf3379f0d20 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Wed, 17 Jul 2019 12:15:28 +1000 Subject: tdf#126421: don't limit pasted data to allocated columns in destination Change-Id: Ic30360795c5dac1dc232f95bd25f5a11946c7dee Reviewed-on: https://gerrit.libreoffice.org/75738 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sc/source/core/data/table2.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sc/source') diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 388e0bb1be61..5b182c897b4b 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -670,17 +670,20 @@ bool ScTable::InitColumnBlockPosition( sc::ColumnBlockPosition& rBlockPos, SCCOL return true; } +// pTable is source + void ScTable::CopyFromClip( sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCCOL nDx, SCROW nDy, ScTable* pTable ) { - if (nCol2 > aCol.size() - 1) - nCol2 = aCol.size() - 1; + if (nCol2 > MAXCOL) + nCol2 = MAXCOL; if (nRow2 > MAXROW) nRow2 = MAXROW; if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)) { + CreateColumnIfNotExists(nCol2); for ( SCCOL i = nCol1; i <= nCol2; i++) { pTable->CreateColumnIfNotExists(i - nDx); -- cgit