Loading...
--- libmalloc/libmalloc-657.60.21/tests/xzone_testing.h
+++ libmalloc/libmalloc-715.140.5/tests/xzone_testing.h
@@ -27,7 +27,11 @@
 	unsigned i = 0;
 
 	malloc_zone_t *zone = malloc_zones[i];
-	if (!strcmp(malloc_get_zone_name(zone), "ProbGuardMallocZone")) {
+
+	const char *name = malloc_get_zone_name(zone);
+	if ((zone->version >= 14 &&
+			zone->introspect->zone_type == MALLOC_ZONE_TYPE_PGM) ||
+			(name && !strcmp(name, "ProbGuardMallocZone"))) {
 		found_pgm = true;
 
 		i++;
@@ -38,6 +42,18 @@
 	}
 
 	T_ASSERT_GE(zone->version, 14, "zone version");
+
+#if CONFIG_SANITIZER
+	if (zone->introspect->zone_type == MALLOC_ZONE_TYPE_SANITIZER &&
+			malloc_sanitizer_is_enabled()) {
+		i++;
+		if (i == malloc_num_zones) {
+			T_ASSERT_FAIL("didn't find xzone zone");
+		}
+		zone = malloc_zones[i];
+	}
+#endif
+
 	if (zone->introspect->zone_type != MALLOC_ZONE_TYPE_XZONE) {
 		// Maybe it's nano?
 		i++;
@@ -45,9 +61,9 @@
 			T_ASSERT_FAIL("didn't find xzone xzone");
 		}
 		malloc_zone_t *helper_zone = malloc_zones[i];
-		const char *name = malloc_get_zone_name(helper_zone);
-		if (strcmp(name, "MallocHelperZone") != 0) {
-			T_ASSERT_FAIL("unexpected zone %s", name);
+		const char *helper_name = malloc_get_zone_name(helper_zone);
+		if (helper_name && strcmp(helper_name, "MallocHelperZone") != 0) {
+			T_ASSERT_FAIL("unexpected zone %s", helper_name);
 		}
 
 		found_nano = true;