[vlc-commits] [Git][videolan/vlc][3.0.x] 6 commits: winvlc: Move breakpad init completely in HAVE_BREAKPAD

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Dec 7 08:41:03 UTC 2023



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
28b191f3 by Marvin Scholz at 2023-12-07T06:36:00+00:00
winvlc: Move breakpad init completely in HAVE_BREAKPAD

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit a7611f68e6da7e564adec3628749d3267a800927)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
05de88f6 by Alexandre Janniaux at 2023-12-07T06:36:00+00:00
winvlc: silence unused warnings

If breakpad is not used, the crash_handling variable is not used too,
but as it's used otherwise this should be silenced.

(cherry picked from commit 81c60915f764b638bb3b18a08abe9b955ab9df01)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
337d8d55 by Steve Lhomme at 2023-12-07T06:36:00+00:00
winvlc: fix potential buffer overflow in crashdump path

(cherry picked from commit 787eba6fa35702429e2d2b643290419558c6be9d)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
d96742d1 by Steve Lhomme at 2023-12-07T06:36:00+00:00
winvlc: don't attempt to send crash dumps if the path can't be found

(cherry picked from commit 520c9e92911e354bfc96406a71e891de116fe67c)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
6b6036cb by Steve Lhomme at 2023-12-07T06:36:00+00:00
winvlc: don't keep the crash path forever in memory

It's copied internally by breakpad.

(cherry picked from commit 3e3292a58d4d67f26140b606cf1e1497f04f15db)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
4a20ef61 by Steve Lhomme at 2023-12-07T06:36:00+00:00
breakpad: fix potential char used with _snwprintf()

The whole Breakpad API on Windows uses wstring.

(cherry picked from commit 1040e9a7ffe78b31a6ffed3ebb3c087ef347c876)
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -


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
=====================================
@@ -209,19 +209,23 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
     argv[argc] = NULL;
     LocalFree (wargv);
 
+#ifdef HAVE_BREAKPAD
     void* eh = NULL;
     if(crash_handling)
     {
-#ifdef HAVE_BREAKPAD
-        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] );
-#endif
+        else if ( !wcscat_s( path, MAX_PATH, L"\\vlc\\crashdump" ) )
+        {
+            CheckCrashDump( path );
+            eh = InstallCrashHandler( path );
+        }
     }
+#else
+    (void)crash_handling;
+#endif
 
     _setmode( _fileno( stdin ), _O_BINARY ); /* Needed for pipes */
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fda14fc7c013eb75291df10cc8b88336c51328ad...4a20ef61d027f5a1c0c1eed3231fde296f2ce623

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fda14fc7c013eb75291df10cc8b88336c51328ad...4a20ef61d027f5a1c0c1eed3231fde296f2ce623
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