diff options
| author | Chris Forbes <chrisforbes@google.com> | 2016-04-29 17:32:16 +1200 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-05-05 06:42:19 -0600 |
| commit | d05d4948403f54e009560e4c907c0e5e6ae242ab (patch) | |
| tree | 191159c462b742afcb3065bf12f5544e5ab851e5 | |
| parent | cc15c6924f392faacc822df0c82d50400cf41673 (diff) | |
| download | usermoji-d05d4948403f54e009560e4c907c0e5e6ae242ab.tar.xz | |
layers: Avoid dereferencing outside array for missing color attachment
Signed-off-by: Chris Forbes <chrisforbes@google.com>
| -rw-r--r-- | layers/core_validation.h | 8 |
1 files 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); |
