summaryrefslogtreecommitdiffstats
path: root/toolkit/crashreporter/breakpad-patches/28-no-garbage-in-code-ids.patch
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/crashreporter/breakpad-patches/28-no-garbage-in-code-ids.patch')
-rw-r--r--toolkit/crashreporter/breakpad-patches/28-no-garbage-in-code-ids.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/toolkit/crashreporter/breakpad-patches/28-no-garbage-in-code-ids.patch b/toolkit/crashreporter/breakpad-patches/28-no-garbage-in-code-ids.patch
new file mode 100644
index 0000000000..64f791d01e
--- /dev/null
+++ b/toolkit/crashreporter/breakpad-patches/28-no-garbage-in-code-ids.patch
@@ -0,0 +1,34 @@
+diff --git a/src/common/linux/file_id.cc b/src/common/linux/file_id.cc
+--- a/src/common/linux/file_id.cc
++++ b/src/common/linux/file_id.cc
+@@ -115,28 +115,27 @@ static bool FindElfBuildIDNote(const voi
+
+ return false;
+ }
+
+ // Attempt to locate the .text section of an ELF binary and generate
+ // a simple hash by XORing the first page worth of bytes into |identifier|.
+ static bool HashElfTextSection(const void* elf_mapped_base,
+ wasteful_vector<uint8_t>& identifier) {
+- identifier.resize(kMDGUIDSize);
+-
+ void* text_section;
+ size_t text_size;
+ if (!FindElfSection(elf_mapped_base, ".text", SHT_PROGBITS,
+ (const void**)&text_section, &text_size) ||
+ text_size == 0) {
+ return false;
+ }
+
+ // Only provide |kMDGUIDSize| bytes to keep identifiers produced by this
+ // function backwards-compatible.
++ identifier.resize(kMDGUIDSize);
+ my_memset(&identifier[0], 0, kMDGUIDSize);
+ const uint8_t* ptr = reinterpret_cast<const uint8_t*>(text_section);
+ const uint8_t* ptr_end = ptr + std::min(text_size, static_cast<size_t>(4096));
+ while (ptr < ptr_end) {
+ for (unsigned i = 0; i < kMDGUIDSize; i++)
+ identifier[i] ^= ptr[i];
+ ptr += kMDGUIDSize;
+ }
+