diff mbox series

[FFmpeg-devel,v2,1/1] return value check for init_get_bits in adts_decode_extradata

Message ID AS8P193MB12542A86E22F8207EC971930B6F19@AS8P193MB1254.EURP193.PROD.OUTLOOK.COM
State Accepted
Commit 9ffa49496d1aae4cbbb387aac28a9e061a6ab0a6
Headers show
Series [FFmpeg-devel,v2,1/1] return value check for init_get_bits in adts_decode_extradata
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Maryam Ebrahimzadeh Aug. 4, 2021, 8:15 p.m. UTC
version2:
As second argument for init_get_bits (buf) can be crafted, return value check for this function call is necessary.
'buf' is  part of  'AVPacket pkt'.
replace init_get_bits with init_get_bits8.
---
 libavformat/adtsenc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Maryam Ebrahimzadeh Aug. 5, 2021, 11:06 a.m. UTC | #1
Ping.

> On Aug 5, 2021, at 12:45 AM, maryam ebrahimzadeh <me22bee@outlook.com> wrote:
> 
> version2:
> As second argument for init_get_bits (buf) can be crafted, return value check for this function call is necessary.
> 'buf' is  part of  'AVPacket pkt'.
> replace init_get_bits with init_get_bits8.
> ---
> libavformat/adtsenc.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
> index ba15c0a724..3924e678d9 100644
> --- a/libavformat/adtsenc.c
> +++ b/libavformat/adtsenc.c
> @@ -53,9 +53,11 @@ static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, const ui
>     GetBitContext gb;
>     PutBitContext pb;
>     MPEG4AudioConfig m4ac;
> -    int off;
> +    int off, ret;
> 
> -    init_get_bits(&gb, buf, size * 8);
> +    ret = init_get_bits8(&gb, buf, size);
> +    if (ret < 0)
> +        return ret;
>     off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
>     if (off < 0)
>         return off;
> -- 
> 2.17.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer Aug. 6, 2021, 2:48 p.m. UTC | #2
On Thu, Aug 05, 2021 at 11:06:00AM +0000, Maryam Ebrahimzadeh wrote:
> Ping.
> 
> > On Aug 5, 2021, at 12:45 AM, maryam ebrahimzadeh <me22bee@outlook.com> wrote:
> > 
> > version2:
> > As second argument for init_get_bits (buf) can be crafted, return value check for this function call is necessary.
> > 'buf' is  part of  'AVPacket pkt'.
> > replace init_get_bits with init_get_bits8.
> > ---
> > libavformat/adtsenc.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index ba15c0a724..3924e678d9 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -53,9 +53,11 @@  static int adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, const ui
     GetBitContext gb;
     PutBitContext pb;
     MPEG4AudioConfig m4ac;
-    int off;
+    int off, ret;
 
-    init_get_bits(&gb, buf, size * 8);
+    ret = init_get_bits8(&gb, buf, size);
+    if (ret < 0)
+        return ret;
     off = avpriv_mpeg4audio_get_config2(&m4ac, buf, size, 1, s);
     if (off < 0)
         return off;