On 09/03/15 01:05, Vittorio Giovara wrote:
> This prevents it to be written as unsigned. Also add an error message.
> 
> CC: [email protected]
> Bug-Id: 1265717
> ---
>  libavformat/matroskaenc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 8688616..f4d2665 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -920,8 +920,11 @@ static int mkv_write_chapters(AVFormatContext *s)
>          int chapterstart = av_rescale_q(c->start, c->time_base, scale);
>          int chapterend   = av_rescale_q(c->end,   c->time_base, scale);
>          AVDictionaryEntry *t = NULL;
> -        if (chapterstart < 0 || chapterstart > chapterend)
> +        if (chapterstart < 0 || chapterstart > chapterend || chapterend < 0) 
> {
> +            av_log(s, AV_LOG_ERROR, "Invalid chapter start (%d) or end 
> (%d).\n",
> +                   chapterstart, chapterend);
>              return AVERROR_INVALIDDATA;
> +        }
>  
>          chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0);
>          put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id);
> 

Ok.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to