[Mesa-stable] [PATCH] anv/formats: Fix an off-by-one in the format array range check

Samuel Iglesias Gonsálvez siglesias at igalia.com
Mon Sep 4 04:59:22 UTC 2017


Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

On Sun, 2017-09-03 at 17:10 -0700, Jason Ekstrand wrote:
> Found with static code analysis
> 
> Cc: mesa-stable at lists.freedesktop.org
> ---
>  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 c23b143..eead1aa 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20170904/44ec6257/attachment.sig>


More information about the mesa-stable mailing list