About coverity 988424 (svdfppt.cxx from filter module)

Caolán McNamara caolanm at redhat.com
Wed Apr 24 09:25:24 PDT 2013


On Sat, 2013-03-16 at 14:03 -0700, julien2412 wrote:
> Hello,
> 
> Scan coverity detected this: 
> CID 988424 (#1 of 1): Logically dead code (DEADCODE)dead_error_line:
> Execution cannot reach this expression "nExtBuInd + nExtParaNibble <
> aStyleTextProp9->size()" inside statement "if (nExtParaNibble && nExtB...". 
> 
> Indeed, we have these lines:
>    5026     if ( nExtParaPos )
>    5027     {
>    5028         sal_uInt32 nExtBuInd = nMask & 0x3c00;
>    5029         sal_uInt32  nExtParaNibble = 0;
>    5030         if ( nExtBuInd )
>    5031             nExtBuInd = ( aSet.mnFlags & 0x3c00 ) >> 10;
>    5032         if ( nExtBuInd < aStyleTextProp9.size() )
>    5033         {
>    5034             if ( nExtParaNibble && ( ( nExtBuInd + nExtParaNibble )
> < aStyleTextProp9.size() ) )
>    5035                 nExtBuInd += nExtParaNibble;
> 
> (see
> http://opengrok.libreoffice.org/xref/core/filter/source/msfilter/svdfppt.cxx#5026)
> 
> Any idea what should be done?

Git doesn't seem able to track back to where this code was really
originally written across the old version control file moves and
removes. But throwing some key words into google I can find the original
code, and can determine it happened with
"StyleTextProp with empty text PPT import (bnc#485630) [Thorsten]" which
appeared to get merged to OpenOffice.org from ooo-build in Jun 2009.

The original code it was based on was originally a loop where multiple
properties were read and it made sense to increment nExtParaNibble
between properties. Now it doesn't.

So, yeah, all lines with nExtParaNibble in them or depend on those lines
or exist only to set that value can be removed as it enters the
condition as 0, and gets useless set to non 0 after exiting the
condition.

C.



More information about the LibreOffice mailing list