Wrong indentation which leads to segfault in sc/source/ui/docshell/docfunc.cxx

julien2412 serval2412 at yahoo.fr
Mon Dec 31 10:18:18 PST 2012


Hello,

1) 
Trying to reproduce fdo#47466 with master sources updated this morning, I
had this: 
#0  0x00007ff8cd039475 in *__GI_raise (sig=<optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ff8cd03c6f0 in *__GI_abort () at abort.c:92
#2  0x00007ff8cd8de31d in __gnu_debug::_Error_formatter::_M_error() const ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ff8ae7c3f24 in
__gnu_debug::_Safe_iterator<std::_Rb_tree_const_iterator<short>,
std::__debug::set<short, std::less<short>, std::allocator<short> >
>::operator* (
    this=0x7fff96484bf0) at /usr/include/c++/4.7/debug/safe_iterator.h:261
#4  0x00007ff8aee0bd21 in ScDocFunc::AutoFormat (this=0x288bd00, rRange=...,
pTabMark=0x297b6d0, nFormatNo=1, bRecord=true, bApi=false)
    at
/home/julien/compile-libreoffice/libo/sc/source/ui/docshell/docfunc.cxx:3743
#5  0x00007ff8af222bd0 in ScViewFunc::AutoFormat (this=0x296a7c0,
nFormatNo=1, bRecord=1 '\001') at
/home/julien/compile-libreoffice/libo/sc/source/ui/view/viewfun2.cxx:1553
#6  0x00007ff8af102636 in ScCellShell::Execute (this=0x29a45a0, rReq=...) at
/home/julien/compile-libreoffice/libo/sc/source/ui/view/cellsh3.cxx:843
...

on console:
Objects involved in the operation:
iterator "this" @ 0x0x7fff96484bf0 {
type =
N11__gnu_debug14_Safe_iteratorISt23_Rb_tree_const_iteratorIsENSt7__debug3setIsSt4lessIsESaIsEEEEE
(mutable iterator);
  state = past-the-end;
  references sequence with type `NSt7__debug3setIsSt4lessIsESaIsEEE' @
0x0x7fff96484bf0
}

I noticed this:
   3740             ScMarkData::iterator itr = aMark.begin(), itrEnd =
aMark.end();
   3741             for (; itr != itrEnd && *itr < nTabCount; ++itr)
   3742                 SetWidthOrHeight( sal_True, 1,nCols, *itr,
SC_SIZE_VISOPT, STD_EXTRA_WIDTH, false, sal_True);
   3743                 SetWidthOrHeight( false,1,nRows, *itr,
SC_SIZE_VISOPT, 0, false, false);
   3744                 rDocShell.PostPaint( 0,0,*itr, MAXCOL,MAXROW,*itr,
   3745                                 PAINT_GRID | PAINT_LEFT | PAINT_TOP
);

Should the for loop include all the block (until line 3745) or something
should be done?

2) It could be linked too
cppcheck detected this:
[sc/source/core/tool/autoform.cxx:749] ->
[sc/source/core/tool/autoform.cxx:752]: (performance) Variable 'bRet' is
reassigned a value before the old one has been used.
[sc/source/core/tool/autoform.cxx:1019] ->
[sc/source/core/tool/autoform.cxx:1029]: (performance) Variable 'bRet' is
reassigned a value before the old one has been used.
[sc/source/core/tool/autoform.cxx:1082] ->
[sc/source/core/tool/autoform.cxx:1092]: (performance) Variable 'bRet' is
reassigned a value before the old one has been used.
[sc/source/core/tool/autoform.cxx:1107] ->
[sc/source/core/tool/autoform.cxx:1110]: (performance) Variable 'bRet' is
reassigned a value before the old one has been used.

In some of these cases, the result of a test is retrieved in bRet but unused
even if there's a problem. 

Any idea?

Julien



--
View this message in context: http://nabble.documentfoundation.org/Wrong-indentation-which-leads-to-segfault-in-sc-source-ui-docshell-docfunc-cxx-tp4026726.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list