Pier Angelo Vendrame pushed to branch tor-browser-153.0a1-16.0-2 at The Tor Project / Applications / Tor Browser Commits: faea1716 by Pier Angelo Vendrame at 2026-07-13T20:54:32+02:00 fixup! BB 41459: WebRTC fails to build under mingw (Part 2) MB 555: Fix COM error string conversion. - - - - - 1 changed file: - third_party/libwebrtc/modules/desktop_capture/win/desktop_capture_utils.cc Changes: ===================================== third_party/libwebrtc/modules/desktop_capture/win/desktop_capture_utils.cc ===================================== @@ -11,9 +11,9 @@ #include "modules/desktop_capture/win/desktop_capture_utils.h" #include <string> +#include <vector> -#include <cstdio> -#include <cstdlib> +#include "rtc_base/strings/string_builder.h" #include "stringapiset.h" namespace webrtc { @@ -25,14 +25,18 @@ std::string ComErrorToString(const _com_error& error) { webrtc::StringBuilder string_builder; string_builder.AppendFormat("HRESULT: 0x%08X, Message: ", error.Error()); #ifdef _UNICODE - WideCharToMultiByte(CP_UTF8, 0, error.ErrorMessage(), -1, - buffer + string_builder.size(), - sizeof(buffer) - string_builder.size(), nullptr, nullptr); - buffer[sizeof(buffer) - 1] = 0; + int size = WideCharToMultiByte(CP_UTF8, 0, error.ErrorMessage(), -1, nullptr, + 0, nullptr, nullptr); + if (size > 0) { + std::vector<char> buffer(static_cast<size_t>(size)); + WideCharToMultiByte(CP_UTF8, 0, error.ErrorMessage(), -1, buffer.data(), + size, nullptr, nullptr); + string_builder << buffer.data(); + } #else string_builder << error.ErrorMessage(); #endif - return buffer; + return string_builder.str(); } } // namespace utils View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/faea1716... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/faea1716... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
Pier Angelo Vendrame (@pierov)