[Mesa-dev] [PATCH mesa] anv: fix off by one in array check
Eric Engestrom
eric at engestrom.ch
Sun Sep 3 18:33:03 UTC 2017
`anv_formats[ARRAY_SIZE(anv_formats)]` is already one too far.
Spotted by Coverity.
CovID: 1417259
Fixes: 242211933a0682696170 "anv/formats: Nicely handle unknown VkFormat enums"
Cc: Jason Ekstrand <jason.ekstrand at intel.com>
Signed-off-by: Eric Engestrom <eric at engestrom.ch>
---
src/intel/vulkan/anv_formats.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index c23b143cac..eead1aa790 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -253,7 +253,7 @@ static const struct anv_format anv_formats[] = {
static bool
format_supported(VkFormat vk_format)
{
- if (vk_format > ARRAY_SIZE(anv_formats))
+ if (vk_format >= ARRAY_SIZE(anv_formats))
return false;
return anv_formats[vk_format].isl_format != ISL_FORMAT_UNSUPPORTED;
--
Cheers,
Eric
More information about the mesa-dev
mailing list