[Libreoffice] [REVIEW] fdo#38457: Crash in DataPilot on moving the fields

Katarina Machalkova kmachalkova at suse.cz
Mon Jun 27 04:59:22 PDT 2011


Ladies & gents, 

attached patch (somehow) fixes the crash in Calc's DataPilot caused by field 
indexes being off-by-N. Consequent attempt to move such fields leads to 
segfault.

It is regression from 3.3, the orig code was as follows:

    SCCOL nColAdd = 0;
    if ( bForFile )
    {
        // in old file format, columns are within document, not within source 
range

        DBG_ASSERT( pSheetDesc, "FillOldParam: bForFile, !pSheetDesc" );
        nColAdd = pSheetDesc->aSourceRange.aStart.Col();
    }

where 'if' branch has been unused since 2004 at least, as 'bForFile' variable 
has been always set to false elsewhere in the code.

Later, it has been changed into this: 

SCCOL nColAdd = pSheetDesc->GetSourceRange().aStart.Col();

apparently to fix a build failure (commit 523a8f41388f6d). But this seems to 
produce wrong results -- shifts column index of DP field by N and attempt to 
move such field crashes the whole thing. 

From the comment in the 3.3 code (mentioning "old file format") I guess we can 
assume column offset always set to 0 i.e. no column offset at all. But not 
really sure about that, this is Yoshida-san's baby.  

Consequently, some further code cleanup could be needed (i.e. nCollAdd param 
can be completely removed from lcl_FillOldFields() ), but that's more a 
material for master branch

hB.
-- 
  \\\\\              Katarina Machalkova    
  \\\\\\\__o          LibO developer
__\\\\\\\'/_          & hedgehog painter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fdo-38456-Always-set-column-offset-to-0.patch
Type: text/x-patch
Size: 1119 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110627/4669dffc/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110627/4669dffc/attachment.pgp>


More information about the LibreOffice mailing list