Re: [gtk-vnc-devel] [PATCH 2/7] Add support for LastRect encoding 2008-11-20 Federico Mena Quintero <federico novell com>



On Thu, 2008-12-18 at 16:27 +0000, Daniel P. Berrange wrote:
> > -		uint16_t n_rects;
> > +		int n_rects;
> 
> Why this change ? THe value being read is an unsigned int16

With LastRect encoding, the server sends n_rects=65535.  So, the
condition in the "for" loop is always true as the counter could wrap
around.  Making it an int makes it safe (even if the actual LastRect
will break the loop at the right time).

[I've had my share of overflowed shorts before, too, so I'm kind of
paranoid about them :) ]

  Federico





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