[Libreoffice-commits] core.git: Branch 'aoo/trunk' - fpicker/source

Ariel Constenla-Haile arielch at apache.org
Fri Oct 25 07:07:48 PDT 2013


 fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 3b16c98449d120b07ca4f2f312e31127ac655482
Author: Ariel Constenla-Haile <arielch at apache.org>
Date:   Fri Oct 25 12:49:16 2013 +0000

    i123544 - Prevent accessing empty filters' vector

diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
index f44ba31..42ebb61 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
@@ -915,15 +915,18 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest)
                     ::rtl::OUString aExt;
                     UINT nFileType;
                     hResult = iDialog->GetFileTypeIndex(&nFileType);
-                    if ( SUCCEEDED(hResult) )
+                    if ( SUCCEEDED(hResult) && nFileType > 0 )
                     {
                         ::sal_Int32 nRealIndex = (nFileType-1); // COM dialog base on 1 ... filter container on 0 .-)
                         ::std::vector< COMDLG_FILTERSPEC > lFilters = lcl_buildFilterList(m_lFilters);
-                        LPCWSTR lpFilterExt = lFilters[nRealIndex].pszSpec;
+                        if ( nRealIndex < lFilters.size() )
+                        {
+                            LPCWSTR lpFilterExt = lFilters[nRealIndex].pszSpec;
 
-                        lpFilterExt = wcsrchr( lpFilterExt, '.' );
-                        if ( lpFilterExt )
-                            aFileURL += reinterpret_cast<const sal_Unicode*>(lpFilterExt);
+                            lpFilterExt = wcsrchr( lpFilterExt, '.' );
+                            if ( lpFilterExt )
+                                aFileURL += reinterpret_cast<const sal_Unicode*>(lpFilterExt);
+                        }
                     }
                 }
 


More information about the Libreoffice-commits mailing list