Skip to content

Commit

Permalink
Fix breakpad patch for IsValidCrashReportId
Browse files Browse the repository at this point in the history
This patch was introduced in the past to accept a backtrace. Recently
though changes upstream changed exactly the patched lines in question to
use an algorithm-based approach to check for the format of the ID.

This change creates a local function in a shadow file to act as a proxy
to make sure we preserve the `-` check as well as a valid id character.

Original issue: brave/brave-browser#14326

Chromium change:
https://chromium.googlesource.com/chromium/src/+/b999986ff24699b81ecd3f45254a4bdf0332698a

commit b999986ff24699b81ecd3f45254a4bdf0332698a
Author: Peter Kasting <[email protected]>
Date:   Wed Oct 25 03:54:27 2023 +0000

    Shorten code by using existing helper APIs, eliminating temps.

    No functional change.

    Bug: none
  • Loading branch information
cdesouza-chromium committed Nov 1, 2023
1 parent 1aeae34 commit 41ac987
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions patches/components-crash-core-app-breakpad_linux.cc.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ index 81578d1e0928a8f67922054864ec777cf2d0ddfe..94997072e4399a27e83fad6258cc3e5d
@@ -1461,7 +1461,7 @@ bool IsValidCrashReportId(const char* buf, size_t bytes_read,
return my_strcmp(buf, "_sys_cr_finished") == 0;
#else
for (size_t i = 0; i < bytes_read; ++i) {
- if (!my_isxdigit(buf[i]))
+ if (!my_isxdigit(buf[i]) && buf[i] != '-')
return false;
}
return true;
@@ -1954,7 +1954,7 @@ void HandleCrashDump(const BreakpadInfo& info) {
return base::ranges::all_of(base::span(buf, bytes_read),
- base::IsHexDigit<char>);
+ IsHexDigitOrDash<char>);
#endif
}

@@ -1950,7 +1950,7 @@ void HandleCrashDump(const BreakpadInfo& info) {
if (upload_child > 0) {
IGNORE_RET(sys_close(fds[1])); // Close write end of pipe.

Expand Down

0 comments on commit 41ac987

Please sign in to comment.