Fix a crash with unbalanced debug markers
If there are more End markers than Begin markers at any time, the vector
that keeps track of the labels will issue a `pop_back()` while being
empty, causing a crash.
This was observed on ANGLE's Vulkan backend executing deqp test
dEQP.GLES2/functional_debug_marker_random.
diff --git a/layers/vk_layer_logging.h b/layers/vk_layer_logging.h
index 6096e23..13e8c5a 100644
--- a/layers/vk_layer_logging.h
+++ b/layers/vk_layer_logging.h
@@ -1162,8 +1162,11 @@
report_data->cmdBufLabelHasInsert = false;
label_iter->second.pop_back();
}
- // Now pop the normal item
- label_iter->second.pop_back();
+ // Guard against unbalanced markers.
+ if (label_iter->second.size() > 0) {
+ // Now pop the normal item
+ label_iter->second.pop_back();
+ }
}
}