Fix out-of-bounds error when adding a comment

Desktop / LibreOffice - Jens Carl [gmx.de] - 8 April 2019 08:29 EDT

The error is related to tdf#50916 and since commit 7282014e362a1529a36c88eb308df8ed359c2cfa it's necessary to retrieve the EndCol via ScTable::ClampToAllocatedColumns() otherwise this error occurs:

/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/8.2.1/debug/vector:417: Error: attempt to subscript container with out-of-bounds index 64, but container only holds 64 elements.

Objects involved in the operation: sequence "this" @ 0x0x555556b28340 { type = std::__debug::vector >, std::allocator > > >; }

The backtrace shows where the error occurs

0 0x00007ffff7b0ed7f in raise () at /usr/lib/libc.so.6 1 0x00007ffff7af9672 in abort () at /usr/lib/libc.so.6 2 0x00007ffff79a16c6 in __gnu_debug::_Error_formatter::_M_error() const (this=0x7fffdf156928 <__gnu_debug::_Error_formatter::_M_at(char const*, unsigned int)::__formatter>) at /build/gcc/src/gcc/libstdc++-v3/src/c++11/debug.cc:1069 3 0x00007fffdcd43fb3 in std::__debug::vector >, std::allocator > > >::operator[](unsigned long) (this=0x555556b28340, __n=64) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/8.2.1/../../../../include/c++/8.2.1/debug/vector:417 4 0x00007fffdce75f5d in ScColContainer::operator[](unsigned long) (this=0x555556b28340, nIndex=64) at sc/inc/colcontainer.hxx:44 5 0x00007fffdcfb45f1 in ScDocument::HasColNotes(short, short) const (this=0x555556b1f9a0, nCol=64, nTab=0) at sc/source/core/data/document.cxx:6563 6 0x00007fffdd2b5473 in ScTable::GetAllNoteCaptionsState(ScRange const&, std::__debug::vector >&) (this=0x555556b28340, rRange=..., rNotes=std::__debug::vector of length 2, capacity 2 = {...}) at sc/source/core/data/table2.cxx:1668 7 0x00007fffdcfb4d85 in ScDocument::GetAllNoteCaptionsState(ScRangeList const&) (this=0x555556b1f9a0, rRanges=...) at sc/source/core/data/document.cxx:6662 8 0x00007fffde20449e in ScCellShell::GetState(SfxItemSet&) (this=0x555556c99fc0, rSet=...) at sc/source/ui/view/cellsh.cxx:1121 9 0x00007fffde200fb8 in SfxStubScCellShellGetState(SfxShell*, SfxItemSet&) (pShell=0x555556c99fc0, rSet=...) at workdir/SdiTarget/sc/sdi/scslots.hxx:7286

Change-Id: I568546cd7a3de510625c6c5d189d84f5f0a7bdb2 Reviewed-on: https://gerrit.libreoffice.org/70399

7f37bfa25a16 Fix out-of-bounds error when adding a comment
sc/source/core/data/table2.cxx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Upstream: cgit.freedesktop.org


  • Share