summaryrefslogtreecommitdiff
path: root/libavcodec/pgssubdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-01-04 21:58:28 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-05 20:31:42 +0100
commitb0a718923bb4a75b0c1cbf283fb17a319b840346 (patch)
treeb757370829b86dbd433aa8f05b90a1e2ad6b5beb /libavcodec/pgssubdec.c
parent8aa3c09c1b5d064225eb87b1c99779f1d8128d0f (diff)
downloadffmpeg-b0a718923bb4a75b0c1cbf283fb17a319b840346.tar.gz
avcodec/pgssubdec: Free subtitle on error
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 Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/pgssubdec.c')
-rw-r--r--libavcodec/pgssubdec.c5
1 files changed, 4 insertions, 1 deletions
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;
}