diff options
Diffstat (limited to 'www-client/chromium/files/chromium-131-EnumTable-crash.patch')
-rw-r--r-- | www-client/chromium/files/chromium-131-EnumTable-crash.patch | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/www-client/chromium/files/chromium-131-EnumTable-crash.patch b/www-client/chromium/files/chromium-131-EnumTable-crash.patch new file mode 100644 index 0000000..f4a6969 --- /dev/null +++ b/www-client/chromium/files/chromium-131-EnumTable-crash.patch @@ -0,0 +1,79 @@ +diff --git a/components/media_router/common/providers/cast/channel/enum_table.h b/components/media_router/common/providers/cast/channel/enum_table.h +index 18fd272c6a..db9d2fb18a 100644 +--- a/components/media_router/common/providers/cast/channel/enum_table.h ++++ b/components/media_router/common/providers/cast/channel/enum_table.h +@@ -16,6 +16,7 @@ + #include <optional> + #include <ostream> + #include <string_view> ++#include <vector> + + #include "base/check_op.h" + #include "base/notreached.h" +@@ -193,7 +194,6 @@ class + inline constexpr GenericEnumTableEntry(int32_t value); + inline constexpr GenericEnumTableEntry(int32_t value, std::string_view str); + +- GenericEnumTableEntry(const GenericEnumTableEntry&) = delete; + GenericEnumTableEntry& operator=(const GenericEnumTableEntry&) = delete; + + private: +@@ -259,7 +259,6 @@ class EnumTable { + constexpr Entry(E value, std::string_view str) + : GenericEnumTableEntry(static_cast<int32_t>(value), str) {} + +- Entry(const Entry&) = delete; + Entry& operator=(const Entry&) = delete; + }; + +@@ -318,15 +317,14 @@ class EnumTable { + if (is_sorted_) { + const std::size_t index = static_cast<std::size_t>(value); + if (ANALYZER_ASSUME_TRUE(index < data_.size())) { +- const auto& entry = data_.begin()[index]; ++ const auto& entry = data_[index]; + if (ANALYZER_ASSUME_TRUE(entry.has_str())) + return entry.str(); + } + return std::nullopt; + } + return GenericEnumTableEntry::FindByValue( +- reinterpret_cast<const GenericEnumTableEntry*>(data_.begin()), +- data_.size(), static_cast<int32_t>(value)); ++ &data_[0], data_.size(), static_cast<int32_t>(value)); + } + + // This overload of GetString is designed for cases where the argument is a +@@ -355,8 +353,7 @@ class EnumTable { + // enum value directly. + std::optional<E> GetEnum(std::string_view str) const { + auto* entry = GenericEnumTableEntry::FindByString( +- reinterpret_cast<const GenericEnumTableEntry*>(data_.begin()), +- data_.size(), str); ++ &data_[0], data_.size(), str); + return entry ? static_cast<E>(entry->value) : std::optional<E>(); + } + +@@ -368,9 +365,9 @@ class EnumTable { + + private: + #ifdef ARCH_CPU_64_BITS +- alignas(std::hardware_destructive_interference_size) ++ alignas(64) + #endif +- std::initializer_list<Entry> data_; ++ const std::vector<Entry> data_; + bool is_sorted_; + + constexpr EnumTable(std::initializer_list<Entry> data, bool is_sorted) +@@ -382,8 +379,8 @@ class EnumTable { + + for (std::size_t i = 0; i < data.size(); i++) { + for (std::size_t j = i + 1; j < data.size(); j++) { +- const Entry& ei = data.begin()[i]; +- const Entry& ej = data.begin()[j]; ++ const Entry& ei = data[i]; ++ const Entry& ej = data[j]; + DCHECK(ei.value != ej.value) + << "Found duplicate enum values at indices " << i << " and " << j; + DCHECK(!(ei.has_str() && ej.has_str() && ei.str() == ej.str())) |