[vlc-commits] [Git][videolan/vlc][master] 4 commits: winvlc: fix potential buffer overflow in crashdump path
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Dec 5 09:04:20 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
787eba6f by Steve Lhomme at 2023-12-05T08:46:09+00:00
winvlc: fix potential buffer overflow in crashdump path
- - - - -
520c9e92 by Steve Lhomme at 2023-12-05T08:46:09+00:00
winvlc: don't attempt to send crash dumps if the path can't be found
- - - - -
3e3292a5 by Steve Lhomme at 2023-12-05T08:46:09+00:00
winvlc: don't keep the crash path forever in memory
It's copied internally by breakpad.
- - - - -
1040e9a7 by Steve Lhomme at 2023-12-05T08:46:09+00:00
breakpad: fix potential char used with _snwprintf()
The whole Breakpad API on Windows uses wstring.
- - - - -
2 changed files:
- bin/breakpad.cpp
- bin/winvlc.c
Changes:
=====================================
bin/breakpad.cpp
=====================================
@@ -42,20 +42,23 @@ static bool FilterCallback(void*, EXCEPTION_POINTERS*, MDRawAssertionInfo*)
extern "C"
{
+#define WIDEN_(x) L ## x
+#define WIDEN(x) WIDEN_(x)
+
void CheckCrashDump( const wchar_t* path )
{
wchar_t pattern[MAX_PATH];
- WIN32_FIND_DATA data;
+ WIN32_FIND_DATAW data;
_snwprintf( pattern, MAX_PATH, L"%s/*.dmp", path );
- HANDLE h = FindFirstFile( pattern, &data );
+ HANDLE h = FindFirstFileW( pattern, &data );
if (h == INVALID_HANDLE_VALUE)
return;
- int answer = MessageBox( NULL, L"Ooops: VLC media player just crashed.\n" \
+ int answer = MessageBoxW( NULL, L"Ooops: VLC media player just crashed.\n" \
"Would you like to send a bug report to the developers team?",
L"VLC crash reporting", MB_YESNO);
std::map<std::wstring, std::wstring> params;
params[L"prod"] = L"VLC";
- params[L"ver"] = TEXT(PACKAGE_VERSION);
+ params[L"ver"] = WIDEN(PACKAGE_VERSION);
do
{
wchar_t fullPath[MAX_PATH];
@@ -65,18 +68,18 @@ void CheckCrashDump( const wchar_t* path )
std::map<std::wstring, std::wstring> files;
files[L"upload_file_minidump"] = fullPath;
google_breakpad::HTTPUpload::SendRequest(
- TEXT( BREAKPAD_URL "/reports" ), params, files,
+ WIDEN( BREAKPAD_URL "/reports" ), params, files,
NULL, NULL, NULL );
}
- DeleteFile( fullPath );
- } while ( FindNextFile( h, &data ) );
+ DeleteFileW( fullPath );
+ } while ( FindNextFileW( h, &data ) );
FindClose(h);
}
void* InstallCrashHandler( const wchar_t* crashdump_path )
{
// Breakpad needs the folder to exist to generate the crashdump
- CreateDirectory( crashdump_path, NULL );
+ CreateDirectoryW( crashdump_path, NULL );
return new(std::nothrow) ExceptionHandler( crashdump_path, FilterCallback,
NULL, NULL, ExceptionHandler::HANDLER_ALL);
}
=====================================
bin/winvlc.c
=====================================
@@ -194,13 +194,15 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
void* eh = NULL;
if(crash_handling)
{
- static wchar_t path[MAX_PATH];
+ wchar_t path[MAX_PATH];
if( S_OK != SHGetFolderPathW( NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE,
NULL, SHGFP_TYPE_CURRENT, path ) )
fprintf( stderr, "Can't open the vlc conf PATH\n" );
- _snwprintf( path+wcslen( path ), MAX_PATH, L"%s", L"\\vlc\\crashdump" );
- CheckCrashDump( &path[0] );
- eh = InstallCrashHandler( &path[0] );
+ else if ( !wcscat_s( path, MAX_PATH, L"\\vlc\\crashdump" ) )
+ {
+ CheckCrashDump( path );
+ eh = InstallCrashHandler( path );
+ }
}
#else
(void)crash_handling;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cd922bee013ea1052ef74d5d70cc079e9e7505fa...1040e9a7ffe78b31a6ffed3ebb3c087ef347c876
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cd922bee013ea1052ef74d5d70cc079e9e7505fa...1040e9a7ffe78b31a6ffed3ebb3c087ef347c876
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list