[Mesa-stable] [Mesa-dev] [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 05:07:17 UTC 2017


I have just see Eric's patch. Forget this R-b.

Sam

On Mon, 2017-09-04 at 06:59 +0200, Samuel Iglesias Gonsálvez wrote:
> 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;
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- 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/f06fff38/attachment.sig>


More information about the mesa-stable mailing list