Re: [PATCH 1/2] server: factor out bitmap_fmt_is_rgb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 16, 2012 at 11:40:51AM -0400, Marc-André Lureau wrote:
> 
> 
> ----- Mensaje original -----
> > ---
> >  server/red_common.h |   11 +++++++++++
> >  server/red_worker.c |   15 +++++++--------
> >  2 files changed, 18 insertions(+), 8 deletions(-)
> > 
> > diff --git a/server/red_common.h b/server/red_common.h
> > index cb7bf71..b9dcd49 100644
> > --- a/server/red_common.h
> > +++ b/server/red_common.h
> > @@ -35,4 +35,15 @@ enum {
> >      STREAM_VIDEO_FILTER
> >  };
> >  
> > +static inline int bitmap_fmt_is_rgb(uint8_t fmt)
> > +{
> > +    static const int BITMAP_FMT_IS_RGB[] = {0, 0, 0, 0, 0, 0, 1, 1,
> > 1, 1};
> > +
> > +    if (fmt >= SPICE_BITMAP_FMT_ENUM_END) {
> > +        spice_warning("fmt >= SPICE_BITMAP_FMT_ENUM_END");
> > +        return 0;
> > +    }
> > +    return BITMAP_FMT_IS_RGB[fmt];
> > +}
> 
> It may still access over the array size. So I would either initialize the array with a fixed size of SPICE_BITMAP_FMT_ENUM_END (good thing imho), or add an additional array size check.
> 
> ack otherwise.

ok, good idea, will do.
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]