On Fri, Feb 03, 2017 at 01:05:27PM +0100, Vittorio Giovara wrote:
> In order to avoid potential integer overflow change the comparison
> andmake sure to use the same unsigned type for both elements.

In order to avoid a potential integer overflow change the comparison
and make sure to use the same unsigned type for both elements.

> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -1983,13 +1983,13 @@ static int mov_read_stsc(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>  
> -static inline int mov_stsc_index_valid(int index, int count)
> +static inline int mov_stsc_index_valid(unsigned int index, unsigned int 
> count)
>  {
> -    return index + 1 < count;
> +    return index < count - 1;

If count is 0, this changes behavior; is that intentional?

> -static inline int mov_get_stsc_samples(MOVStreamContext *sc, int index)
> +static inline int mov_get_stsc_samples(MOVStreamContext *sc, unsigned int 
> index)

I'd use plain "unsigned" everywhere, but whatever.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to