summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2020-11-09 10:20:53 +0100
committerDamiano Galassi <[email protected]>2020-11-09 10:20:53 +0100
commit3d3cdbc4f7829bd04e5edba242bab2cf08826f18 (patch)
tree0fbb1c816cc0e1a2db48eff5095f2438f3456e3f /libhb
parentaa2d4d80fb40465e570b008adb418081f975dac8 (diff)
reader: fail early if the chapter indexes are out of bound. Fixes #2594.
Diffstat (limited to 'libhb')
-rw-r--r--libhb/reader.c7
1 files changed, 7 insertions, 0 deletions
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;