aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-04 17:10:38 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-31 19:51:56 +0100
commit292c49227116173c829144249496f190dd4b29a8 (patch)
treee578f9f483902265ce17ca0bf38687ad30cd2759
parent44b48d6acbbdce6e6bbd7c8189ae457094a005b3 (diff)
downloadffmpeg-292c49227116173c829144249496f190dd4b29a8.tar.gz
avformat/subtitles: Check nb_subs in ff_subtitles_queue_finalize()
Fixes: null pointer dereference Fixes: 17828/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5645915116797952 Fixes: Ticket8147 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 81b53913bbb97234e22187d1122948c351a3466d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/subtitles.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index 659c99d1cf..a3240d88a1 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -194,6 +194,9 @@ void ff_subtitles_queue_finalize(void *log_ctx, FFDemuxSubtitlesQueue *q)
{
int i;
+ if (!q->nb_subs)
+ return;
+
qsort(q->subs, q->nb_subs, sizeof(*q->subs),
q->sort == SUB_SORT_TS_POS ? cmp_pkt_sub_ts_pos
: cmp_pkt_sub_pos_ts);