aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-04 17:10:38 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-11 20:18:47 +0100
commit878ba993166ef2b86acf46cfce8a7a8107ceb04b (patch)
tree0f1c3ede70d6f9e0bfa2a2f0ed7d914ebb4edbe8
parent2f20bd7076e9fbbcca77991b925598a5d045032f (diff)
downloadffmpeg-878ba993166ef2b86acf46cfce8a7a8107ceb04b.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 93c9ef05cf..1230e34d08 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);