Resolves: rhbz#1900428 don't crash on invalid index used in StarBasic macro

f41
Caolán McNamara 4 years ago
parent 760b2d0cfa
commit 7f69780353

@ -0,0 +1,38 @@
From 800731dd5910e5af928f05a77a921abe13ec8346 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Mon, 23 Nov 2020 10:04:38 +0000
Subject: [PATCH] Resolves: rhbz#1900428 don't crash on invalid index used in
StarBasic macro
Change-Id: I05064f7e9216c9c43b49950b309afe72466857a6
---
dbaccess/source/core/api/RowSetBase.cxx | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 0bbe5e80ae0a..df8c46a72554 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -230,11 +230,16 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 columnIndex)
OSL_ENSURE( pTemp != reinterpret_cast<void*>(0xfeeefeee),"HALT!" );
}
OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow < m_pCache->getEnd() && aCacheIter != m_pCache->m_aCacheIterators.end(),"Invalid iterator set for currentrow!");
- ORowSetRow rRow = *m_aCurrentRow;
- OSL_ENSURE(rRow.is() && o3tl::make_unsigned(columnIndex) < rRow->size(),"Invalid size of vector!");
#endif
+ ORowSetRow rRow = *m_aCurrentRow;
+ bool bValidPosition = rRow.is() && o3tl::make_unsigned(columnIndex) < rRow->size();
+ if (!bValidPosition)
+ {
+ SAL_WARN("dbaccess", "ORowSetBase::getValue: Invalid size of vector!");
+ ::dbtools::throwSQLException( DBA_RES( RID_STR_CURSOR_BEFORE_OR_AFTER ), StandardSQLState::INVALID_CURSOR_POSITION, *m_pMySelf );
+ }
m_nLastColumnIndex = columnIndex;
- return (**m_aCurrentRow)[m_nLastColumnIndex];
+ return (*rRow)[m_nLastColumnIndex];
}
// we should normally never reach this
--
2.28.0

@ -50,7 +50,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: %{libo_version}.1
Release: 2%{?libo_prerelease}%{?dist}
Release: 3%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and MPLv2.0 and CC0
URL: http://www.libreoffice.org/
@ -255,6 +255,7 @@ Patch7: 0001-export-HYPERLINK-target-in-html-clipboard-export.patch
Patch8: 0001-rhbz-1891326-suggest-package-install-of-the-most-app.patch
Patch9: 0001-fix-disable-pdfium-build.patch
Patch10: 0001-gcc11.patch
Patch11: 0001-Resolves-rhbz-1900428-don-t-crash-on-invalid-index-u.patch
%if 0%{?rhel}
# not upstreamed
@ -2263,10 +2264,13 @@ done
%{_includedir}/LibreOfficeKit
%changelog
* Tue Nov 03 2020 Jeff Law <law@redhat.com> - 1:7.0.3.2-2
* Mon Nov 23 2020 Caolán McNamara <caolanm@redhat.com> - 1:7.0.3.1-3
- Resolves: rhbz#1900428 don't crash on invalid index used in StarBasic macro
* Tue Nov 03 2020 Jeff Law <law@redhat.com> - 1:7.0.3.1-2
- Fix missing #include for gcc-11
* Thu Oct 29 2020 Caolán McNamara <caolanm@redhat.com> - 1:7.0.3.2-1
* Thu Oct 29 2020 Caolán McNamara <caolanm@redhat.com> - 1:7.0.3.1-1
- latest version
* Sun Oct 25 2020 Caolán McNamara <caolanm@redhat.com> - 1:7.0.2.2-3

Loading…
Cancel
Save