[FFmpeg-devel] [PATCH 1/3] h264: ff_h264_decode_extradata: check buffer size

Michael Niedermayer michaelni at gmx.at
Sat Sep 24 21:13:41 CEST 2011


On Sat, Sep 24, 2011 at 08:36:53PM +0200, Alexander Strasser wrote:
>   The buffer size was not checked prior to testing the first byte
> of the buffer. This is sometimes checked before calling but it is
> better to add it here as the function takes buf and size arguments
> now anyway.
> ---
>  libavcodec/h264.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index ec5a464..6655749 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -995,6 +995,9 @@ int ff_h264_decode_extradata(H264Context *h, const uint8_t *buf, int size)
>  {
>      AVCodecContext *avctx = h->s.avctx;
>  
> +    if(size <= 0)
> +      return -1;

indent should be 4 spaces, otherwise LGTM

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

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
-------------- 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/20110924/a9cc162a/attachment.asc>


More information about the ffmpeg-devel mailing list