[Libreoffice-commits] core.git: sc/source
Jens Carl (via logerrit)
logerrit at kemper.freedesktop.org
Mon Apr 8 08:30:21 UTC 2019
sc/source/core/data/table2.cxx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit 7f37bfa25a16bc66af4c236850503de1d0fb8336
Author: Jens Carl <j.carl43 at gmx.de>
AuthorDate: Sun Apr 7 22:43:01 2019 -0700
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Apr 8 10:29:59 2019 +0200
Fix out-of-bounds error when adding a comment
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::unique_ptr<ScColumn, std::default_delete<ScColumn> >, std::allocator<std::unique_ptr<ScColumn, std::default_delete<ScColumn> > > >;
}
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::unique_ptr<ScColumn, std::default_delete<ScColumn> >, std::allocator<std::unique_ptr<ScColumn, std::default_delete<ScColumn> > > >::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<sc::NoteEntry, std::allocator<sc::NoteEntry> >&)
(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
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 9839763e8a14..2a288c46423f 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1656,7 +1656,9 @@ CommentCaptionState ScTable::GetAllNoteCaptionsState(const ScRange& rRange, std:
bool bIsFirstNoteShownState = true; // because of error: -Werror=maybe-uninitialized
bool bFirstControl = true;
- for (SCCOL nCol = rRange.aStart.Col(); nCol <= rRange.aEnd.Col(); ++nCol)
+ ScTable* pTab = pDocument->FetchTable(nTab);
+ const SCCOL nEndCol = pTab->ClampToAllocatedColumns(rRange.aEnd.Col());
+ for (SCCOL nCol = rRange.aStart.Col(); nCol <= nEndCol; ++nCol)
{
if (bFirstControl && pDocument->HasColNotes(nCol, nTab)) // detect status of first note caption
{
More information about the Libreoffice-commits
mailing list