Skip to content

Commit

Permalink
[beta] [vm] Ensure CpuInfo Windows flag detection works.
Browse files Browse the repository at this point in the history
BUG=flutter/flutter#140138
BUG=flutter/flutter#138784
BUG=flutter/flutter#138693
TEST=manually on win x64 with `__ int3();` added in front of `roundsd` and forced `CpuId::sse41=false;`

Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/357218
Cherry-pick-request: #55211
Change-Id: I90a60d4972c5183d43516c628b68a71b7cc76912
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357983
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
  • Loading branch information
aam authored and Commit Queue committed Mar 19, 2024
1 parent 9711ea3 commit 4f5f3df
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion runtime/vm/cpuinfo_win.cc
Expand Up @@ -50,7 +50,11 @@ void CpuInfo::Cleanup() {

bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) {
if (method_ == kCpuInfoCpuId) {
return CpuId::field(idx);
const char* field = CpuId::field(idx);
if (field == nullptr) return false;
bool contains = (strstr(field, search_string) != nullptr);
free(const_cast<char*>(field));
return contains;
} else {
UNREACHABLE();
}
Expand Down

0 comments on commit 4f5f3df

Please sign in to comment.