[vm] Ensure CpuInfo Windows flag detection works.

Fixes https://github.com/flutter/flutter/issues/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 <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
This commit is contained in:
Alexander Aprelev 2024-03-15 19:26:13 +00:00 committed by Commit Queue
parent 94abcc81ab
commit c5946a1195

View file

@ -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();
}