[FFmpeg-devel] [PATCH 3/8] Prevent svq3_get_ue_golomb() from returning a negative value.

Michael Niedermayer michaelni at gmx.at
Sat Sep 17 17:49:32 CEST 2011


On Sat, Sep 17, 2011 at 04:56:31PM +0200, fenrir at elivagar.org wrote:
> From: Laurent Aimar <fenrir at videolan.org>
> 
> ---
>  libavcodec/golomb.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
> index 83d277f..58707ed 100644
> --- a/libavcodec/golomb.h
> +++ b/libavcodec/golomb.h
> @@ -124,7 +124,7 @@ static inline int svq3_get_ue_golomb(GetBitContext *gb){
>          }
>  
>          CLOSE_READER(re, gb);
> -        return ret - 1;
> +        return (ret - 1) & INT_MAX;

the individual uses of this function should check if the data is within
the supported range.
simply forcing it to be positiv is unlikely to be enough for all
cases. Also it causes a tiny speedloss where such checks exists
already

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110917/1822fb6f/attachment.asc>


More information about the ffmpeg-devel mailing list