diff mbox series

[FFmpeg-devel,1/2] avcodec/pgssubdec: Free subtitle on error

Message ID 20200104230439.29452-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/2] avcodec/pgssubdec: Free subtitle on error | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Michael Niedermayer Jan. 4, 2020, 11:04 p.m. UTC
Fixes: Assertion failure
Fixes: 19753/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGSSUB_fuzzer-5688461843759104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/pgssubdec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Jan. 5, 2020, 7:44 a.m. UTC | #1
lgtm

On 1/5/20, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: Assertion failure
> Fixes:
> 19753/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGSSUB_fuzzer-5688461843759104
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/pgssubdec.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
> index 8c10f6d573..7fadcb8b4b 100644
> --- a/libavcodec/pgssubdec.c
> +++ b/libavcodec/pgssubdec.c
> @@ -691,8 +691,11 @@ static int decode(AVCodecContext *avctx, void *data,
> int *data_size,
>              ret = AVERROR_INVALIDDATA;
>              break;
>          }
> -        if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
> +        if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) {
> +            avsubtitle_free(data);
> +            *data_size = 0;
>              return ret;
> +        }
>
>          buf += segment_length;
>      }
> --
> 2.24.0
>
> _______________________________________________
> 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 Jan. 5, 2020, 11:37 a.m. UTC | #2
On Sun, Jan 05, 2020 at 08:44:50AM +0100, Paul B Mahol wrote:
> lgtm

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 8c10f6d573..7fadcb8b4b 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -691,8 +691,11 @@  static int decode(AVCodecContext *avctx, void *data, int *data_size,
             ret = AVERROR_INVALIDDATA;
             break;
         }
-        if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
+        if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) {
+            avsubtitle_free(data);
+            *data_size = 0;
             return ret;
+        }
 
         buf += segment_length;
     }