https://issues.apache.org/ooo/show_bug.cgi?id=123544
--- Comment #6 from Ariel Constenla-Haile <[email protected]> --- (In reply to Ariel Constenla-Haile from comment #4) > Created attachment 81818 [details] > Writer document with a macro to test This one crashes on Windows 7, it isn't setting any filter, so the following code tries to access element 0 of an empty vector: http://svn.apache.org/viewvc/openoffice/trunk/main/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx?diff_format=h&revision=1497691&view=markup#l922 On 3.4.1 it does not crash (but the dialog does not show up). The crash is likely a regression introduced by stlport removal. hResult = iDialog->GetFileTypeIndex(&nFileType); will return S_OK but nFileType will be 0 when no filters were specified. So the check should be: if ( SUCCEEDED(hResult) && nFileType > 0 ) this would already prevent accessing an empty vector, any way it would be safer to check nRealIndex against the vector actual size. Altogether: if ( bValue ) { ::rtl::OUString aExt; UINT nFileType; hResult = iDialog->GetFileTypeIndex(&nFileType); 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); if ( nRealIndex < lFilters.size() ) { LPCWSTR lpFilterExt = lFilters[nRealIndex].pszSpec; lpFilterExt = wcsrchr( lpFilterExt, '.' ); if ( lpFilterExt ) aFileURL += reinterpret_cast<const sal_Unicode*>(lpFilterExt); } } } -- You are receiving this mail because: You are on the CC list for the bug. You are the assignee for the bug. You are watching all bug changes.
