Skip to content

Commit c5946a1

Browse files
aamCommit Queue
authored andcommitted
[vm] Ensure CpuInfo Windows flag detection works.
Fixes flutter/flutter#140138 TEST=manually on win x64 with `__ int3();` added in front of `roundsd` and forced `CpuId::sse41=false;` Change-Id: I9e2dbf2615549dcc7c979036b5442276c2e0fb29 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357218 Reviewed-by: Ryan Macnak <[email protected]> Commit-Queue: Alexander Aprelev <[email protected]>
1 parent 94abcc8 commit c5946a1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

runtime/vm/cpuinfo_win.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ void CpuInfo::Cleanup() {
5050

5151
bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) {
5252
if (method_ == kCpuInfoCpuId) {
53-
return CpuId::field(idx);
53+
const char* field = CpuId::field(idx);
54+
if (field == nullptr) return false;
55+
bool contains = (strstr(field, search_string) != nullptr);
56+
free(const_cast<char*>(field));
57+
return contains;
5458
} else {
5559
UNREACHABLE();
5660
}

0 commit comments

Comments
 (0)