diff mbox

[FFmpeg-devel] avcodec/extract_extradata_bsf: Don't unref uninitialized buffers

Message ID 20191130063810.9665-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 76e0ecec0bfade85796ccfeb9ffdfd55c666612e
Headers show

Commit Message

Andreas Rheinhardt Nov. 30, 2019, 6:38 a.m. UTC
This happens if allocating extradata fails and s->remove is unset.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/extract_extradata_bsf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paul B Mahol Nov. 30, 2019, 9:12 a.m. UTC | #1
On 11/30/19, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> This happens if allocating extradata fails and s->remove is unset.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/extract_extradata_bsf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/extract_extradata_bsf.c
> b/libavcodec/extract_extradata_bsf.c
> index ff111de48c..15ffed6ba0 100644
> --- a/libavcodec/extract_extradata_bsf.c
> +++ b/libavcodec/extract_extradata_bsf.c
> @@ -85,7 +85,7 @@ static int extract_extradata_av1(AVBSFContext *ctx,
> AVPacket *pkt,
>      }
>
>      if (extradata_size && has_seq) {
> -        AVBufferRef *filtered_buf;
> +        AVBufferRef *filtered_buf = NULL;
>          uint8_t *extradata, *filtered_data;
>
>          if (s->remove) {
> @@ -179,7 +179,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx,
> AVPacket *pkt,
>      if (extradata_size &&
>          ((ctx->par_in->codec_id == AV_CODEC_ID_HEVC && has_sps && has_vps)
> ||
>           (ctx->par_in->codec_id == AV_CODEC_ID_H264 && has_sps))) {
> -        AVBufferRef *filtered_buf;
> +        AVBufferRef *filtered_buf = NULL;
>          uint8_t *extradata, *filtered_data;
>
>          if (s->remove) {
> --
> 2.21.0
>

LGTM

> _______________________________________________
> 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".
James Almer Nov. 30, 2019, 1 p.m. UTC | #2
On 11/30/2019 6:12 AM, Paul B Mahol wrote:
> On 11/30/19, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
>> This happens if allocating extradata fails and s->remove is unset.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
>> ---
>>  libavcodec/extract_extradata_bsf.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/extract_extradata_bsf.c
>> b/libavcodec/extract_extradata_bsf.c
>> index ff111de48c..15ffed6ba0 100644
>> --- a/libavcodec/extract_extradata_bsf.c
>> +++ b/libavcodec/extract_extradata_bsf.c
>> @@ -85,7 +85,7 @@ static int extract_extradata_av1(AVBSFContext *ctx,
>> AVPacket *pkt,
>>      }
>>
>>      if (extradata_size && has_seq) {
>> -        AVBufferRef *filtered_buf;
>> +        AVBufferRef *filtered_buf = NULL;
>>          uint8_t *extradata, *filtered_data;
>>
>>          if (s->remove) {
>> @@ -179,7 +179,7 @@ static int extract_extradata_h2645(AVBSFContext *ctx,
>> AVPacket *pkt,
>>      if (extradata_size &&
>>          ((ctx->par_in->codec_id == AV_CODEC_ID_HEVC && has_sps && has_vps)
>> ||
>>           (ctx->par_in->codec_id == AV_CODEC_ID_H264 && has_sps))) {
>> -        AVBufferRef *filtered_buf;
>> +        AVBufferRef *filtered_buf = NULL;
>>          uint8_t *extradata, *filtered_data;
>>
>>          if (s->remove) {
>> --
>> 2.21.0
>>
> 
> LGTM

Applied.
diff mbox

Patch

diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c
index ff111de48c..15ffed6ba0 100644
--- a/libavcodec/extract_extradata_bsf.c
+++ b/libavcodec/extract_extradata_bsf.c
@@ -85,7 +85,7 @@  static int extract_extradata_av1(AVBSFContext *ctx, AVPacket *pkt,
     }
 
     if (extradata_size && has_seq) {
-        AVBufferRef *filtered_buf;
+        AVBufferRef *filtered_buf = NULL;
         uint8_t *extradata, *filtered_data;
 
         if (s->remove) {
@@ -179,7 +179,7 @@  static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt,
     if (extradata_size &&
         ((ctx->par_in->codec_id == AV_CODEC_ID_HEVC && has_sps && has_vps) ||
          (ctx->par_in->codec_id == AV_CODEC_ID_H264 && has_sps))) {
-        AVBufferRef *filtered_buf;
+        AVBufferRef *filtered_buf = NULL;
         uint8_t *extradata, *filtered_data;
 
         if (s->remove) {