From d05d4948403f54e009560e4c907c0e5e6ae242ab Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 29 Apr 2016 17:32:16 +1200 Subject: layers: Avoid dereferencing outside array for missing color attachment Signed-off-by: Chris Forbes --- layers/core_validation.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/layers/core_validation.h b/layers/core_validation.h index d12fc0b2..a753bcb6 100644 --- a/layers/core_validation.h +++ b/layers/core_validation.h @@ -321,9 +321,13 @@ struct RENDER_PASS_NODE { color_formats.reserve(subpass->colorAttachmentCount); for (j = 0; j < subpass->colorAttachmentCount; j++) { const uint32_t att = subpass->pColorAttachments[j].attachment; - const VkFormat format = pCreateInfo->pAttachments[att].format; - color_formats.push_back(format); + if (att != VK_ATTACHMENT_UNUSED) { + color_formats.push_back(pCreateInfo->pAttachments[att].format); + } + else { + color_formats.push_back(VK_FORMAT_UNDEFINED); + } } subpassColorFormats.push_back(color_formats); -- cgit v1.2.3