[Bug]: Crash handler fails to start on Windows when a path contains non-ASCII characters

Aperta Adatta ai principianti
#1,428 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cpp

Direzione di ricerca

Inizia in src/lib/base/TwkUtil/CrashHandler.cpp, in StringToFilePath, e analizza i chiamanti che forniscono percorsi UTF-8. Riproduci il problema con bin\rvio.exe -version o rv.exe da un percorso Windows contenente caratteri non ASCII; il lavoro è completato quando il gestore dei crash si inizializza correttamente e il comportamento esistente per i percorsi ASCII rimane invariato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Issue: Acknowledged
What happened?

On Windows, the crash handler fails to start when any of its paths contains non-ASCII characters:

ERROR: Failed to start Crashpad handler
ERROR: Failed to initialize crash handler

StringToFilePath in src/lib/base/TwkUtil/CrashHandler.cpp builds the wide path with

std::wstring wpath(path.begin(), path.end());

which widens the UTF-8 bytes one by one. A non-ASCII character in the install directory (handler path), in the crash dump directory under %APPDATA% (e.g. a non-ASCII Windows user name), or in the log file path is mangled, so Crashpad gets a path that does not exist. Playback still works, so crash dumps are silently lost.

Steps to reproduce

  1. Put a Windows build under a folder with non-ASCII characters (e.g. C:\테스트 폴더\OpenRV).
  2. Run bin\rvio.exe -version (or rv.exe).
  3. The errors above are printed. The same build under an ASCII path (spaces are fine) prints INFO: Crash handler initialized successfully.

Expected: the crash handler initializes regardless of the characters in the path.

Suggested fix: all callers pass UTF-8 (QString::toStdString), so decode through Qt instead of widening bytes:

#if defined(PLATFORM_WINDOWS)
        return base::FilePath(QString::fromStdString(path).toStdWString());
#else

With this change, the same build under a non-ASCII path with spaces prints Crash handler initialized successfully.

List all the operating systems versions where this is happening

Windows 11 (build 26200). Built from main @ 8be16d55, CY2024, Release.

On what computer hardware is this happening?

Not hardware-specific (reproduced on an x64 workstation, 32 GB RAM).

Relevant console log output
ERROR: Failed to start Crashpad handler
ERROR: Failed to initialize crash handler
Code of Conduct
  • I agree to follow this project's Code of Conduct
Lingua principale
C++
Stelle
797
Fork
259
Merge medio
4g 4h
PR unite (30g)
34

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AcademySoftwareFoundation/OpenRV

Tutte le issue di AcademySoftwareFoundation/OpenRV

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.