Author: arielch
Date: Fri Oct 25 12:49:16 2013
New Revision: 1535717

URL: http://svn.apache.org/r1535717
Log:
i123544 - Prevent accessing empty filters' vector

Modified:
    
openoffice/trunk/main/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx

Modified: 
openoffice/trunk/main/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx?rev=1535717&r1=1535716&r2=1535717&view=diff
==============================================================================
--- 
openoffice/trunk/main/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx 
(original)
+++ 
openoffice/trunk/main/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx 
Fri Oct 25 12:49:16 2013
@@ -915,15 +915,18 @@ void VistaFilePickerImpl::impl_sta_ShowD
                     ::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);
+                        }
                     }
                 }
 


Reply via email to