diff --git a/tests/test_phase4.cpp b/tests/test_phase4.cpp index f355501..22727fb 100644 --- a/tests/test_phase4.cpp +++ b/tests/test_phase4.cpp @@ -5300,8 +5300,11 @@ void testXmrigAssetSelection() EXPECT_TRUE(linux >= 0); EXPECT_TRUE(win >= 0); EXPECT_TRUE(linux != win); - EXPECT_TRUE(rel.assets[linux].name.find("linux-x64.zip") != std::string::npos); - EXPECT_TRUE(rel.assets[win].name.find("win-x64.zip") != std::string::npos); + // Guard the index reads: select*Asset returns -1 when nothing matches, and EXPECT_TRUE doesn't + // abort this harness, so an unguarded rel.assets[-1] on a fixture/parser regression would SIGSEGV + // the whole suite instead of reporting the failed EXPECT above. + if (linux >= 0) EXPECT_TRUE(rel.assets[linux].name.find("linux-x64.zip") != std::string::npos); + if (win >= 0) EXPECT_TRUE(rel.assets[win].name.find("win-x64.zip") != std::string::npos); // No macOS build in this fixture -> graceful "not found". EXPECT_EQ(selectXmrigAsset(rel, "macos-x86_64"), -1); EXPECT_EQ(selectXmrigAsset(rel, "macos-arm64"), -1); @@ -5607,9 +5610,11 @@ void testDaemonAssetSelection() const int win = selectDaemonAsset(rel, "win64"); EXPECT_TRUE(lin >= 0 && mac >= 0 && win >= 0); EXPECT_TRUE(lin != mac && mac != win && lin != win); - EXPECT_TRUE(rel.assets[lin].name.find("linux-amd64.zip") != std::string::npos); - EXPECT_TRUE(rel.assets[mac].name.find("macos.zip") != std::string::npos); - EXPECT_TRUE(rel.assets[win].name.find("win64.zip") != std::string::npos); + // Guard the index reads (select*Asset returns -1 on no match; EXPECT_TRUE doesn't abort here) so a + // fixture/parser regression reports the failed EXPECT above instead of an OOB rel.assets[-1] crash. + if (lin >= 0) EXPECT_TRUE(rel.assets[lin].name.find("linux-amd64.zip") != std::string::npos); + if (mac >= 0) EXPECT_TRUE(rel.assets[mac].name.find("macos.zip") != std::string::npos); + if (win >= 0) EXPECT_TRUE(rel.assets[win].name.find("win64.zip") != std::string::npos); // Wrong/foreign tokens (e.g. the miner's naming) must NOT match the daemon archives. EXPECT_EQ(selectDaemonAsset(rel, "linux-x64"), -1); EXPECT_EQ(selectDaemonAsset(rel, "linux-arm64"), -1);