From 3d3cdbc4f7829bd04e5edba242bab2cf08826f18 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Mon, 9 Nov 2020 10:20:53 +0100 Subject: reader: fail early if the chapter indexes are out of bound. Fixes #2594. --- libhb/reader.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libhb') diff --git a/libhb/reader.c b/libhb/reader.c index 800b4caad..f7cab0e40 100644 --- a/libhb/reader.c +++ b/libhb/reader.c @@ -279,6 +279,13 @@ static int reader_init( hb_work_object_t * w, hb_job_t * job ) else { int count = hb_list_count(job->title->list_chapter); + + if (job->chapter_end > count || job->chapter_start > count || job->chapter_start > job->chapter_end) + { + hb_error("Invalid chapter start/end indexes"); + return 1; + } + if (count == 0 || count <= job->chapter_end) { r->duration = job->title->duration; -- cgit v1.2.3