dbaccess/source/ui/dlg/generalpage.cxx |    7 ++++++-
 include/sal/log-areas.dox              |    1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 9b1d8d864b813ebf943b85b129335d7d55e35c41
Author: Javier Fernandez <jfernan...@igalia.com>
Date:   Thu Jun 6 09:14:49 2013 +0000

    fdo#67361 Prevent out-of-range values coming from ListBox GetSelectEntryPos.
    
    Applied to master (LibreOffice 4.2.0.alpha) as:
     Change-Id: Ia787c412408ef53db3c8458f54c7843c669c81ad
     Reviewed-on: https://gerrit.libreoffice.org/4174
     Reviewed-by: Lionel Elie Mamane <lio...@mamane.lu>
     Tested-by: Lionel Elie Mamane <lio...@mamane.lu>
    (without the fdo#67361 reference)
    
    Squash with subsequent fixups:
    
    1) -Werror=sign-compare
    
       (ListBox::GetSelectEntryPos returns sal_uInt16)
    
       Change-Id: Ia6e4bf4354523f5112ee3ade1d3da6db0f9ab2c4
    
    2) Fix previous fix
    
       Change-Id: I2d7ea38b743d78327fd19886019c1106bc1316d6
    
    Also fix discrepancy between log-areas.dox and SAL_WARN argument.
    
    Change-Id: I03fc1014da0be8335689954725ac605e32fbbee8
    Reviewed-on: https://gerrit.libreoffice.org/5176
    Reviewed-by: Tomáš Chvátal <tchva...@suse.cz>
    Tested-by: Tomáš Chvátal <tchva...@suse.cz>
    Reviewed-by: Michael Meeks <michael.me...@suse.com>
    Tested-by: Michael Meeks <michael.me...@suse.com>

diff --git a/dbaccess/source/ui/dlg/generalpage.cxx 
b/dbaccess/source/ui/dlg/generalpage.cxx
index 3eea60a..6a79acf 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -328,7 +328,12 @@ namespace dbaui
     IMPL_LINK( OGeneralPage, OnDatasourceTypeSelected, ListBox*, _pBox )
     {
         // get the type from the entry data
-        sal_Int16 nSelected = _pBox->GetSelectEntryPos();
+        sal_uInt16 nSelected = _pBox->GetSelectEntryPos();
+        if (nSelected >= m_aURLPrefixes.size() )
+        {
+            SAL_WARN("dbaccess.ui.OGeneralPage", "Got out-of-range value '" << 
nSelected <<  "' from the DatasourceType selection ListBox's 
GetSelectEntryPos(): no corresponding URL prefix");
+            return 0L;
+        }
         const OUString sURLPrefix = m_aURLPrefixes[ nSelected ];
 
         setParentTitle( sURLPrefix );
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index bee62d6..e04e877 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -332,6 +332,7 @@ certain functionality.
 
 @li @c dbaccess
 @li @c dbaccess.ui
+@li @c dbaccess.ui.OGeneralPage
 
 @section svx
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to