[FFmpeg-devel] [PATCH 2/2] avformat/subtitles: Check for NOPTS in ff_subtitles_queue_finalize()

Nicolas George george at nsup.org
Tue Jun 23 15:08:44 EEST 2020


Michael Niedermayer (12020-06-23):
> Fixes; signed integer overflow: 1 - -9223372036854775808 cannot be represented in type 'long'
> Fixes: 23490/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5133490093031424
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  libavformat/subtitles.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
> index ad7f68938e..ccab80391f 100644
> --- a/libavformat/subtitles.c
> +++ b/libavformat/subtitles.c
> @@ -202,7 +202,7 @@ void ff_subtitles_queue_finalize(void *log_ctx, FFDemuxSubtitlesQueue *q)
>            q->sort == SUB_SORT_TS_POS ? cmp_pkt_sub_ts_pos
>                                       : cmp_pkt_sub_pos_ts);
>      for (i = 0; i < q->nb_subs; i++)
> -        if (q->subs[i].duration < 0 && i < q->nb_subs - 1)
> +        if (q->subs[i].duration < 0 && i < q->nb_subs - 1 && q->subs[i].pts != AV_NOPTS_VALUE)
>              q->subs[i].duration = q->subs[i + 1].pts - q->subs[i].pts;
>  
>      if (!q->keep_duplicates)

Having no PTS at this point makes no sense. We should examine why it
arrived there. Can you share the test case?

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200623/8eb4d168/attachment.sig>


More information about the ffmpeg-devel mailing list