Commit c70a8ee9 authored by hpi1's avatar hpi1

Check if chapter/mark is valid in bd_seek_chapter()/bd_seek_mark()

parent 1c3ca408
......@@ -386,10 +386,15 @@ int64_t bd_seek_chapter(BLURAY *bd, int chapter)
uint32_t clip_pkt, out_pkt;
NAV_CLIP *clip;
// Find the closest access unit to the requested position
clip = nav_chapter_search(bd->title, chapter, &clip_pkt, &out_pkt);
if (chapter < bd->title->chap_list.count) {
// Find the closest access unit to the requested position
clip = nav_chapter_search(bd->title, chapter, &clip_pkt, &out_pkt);
return _seek_internal(bd, clip, out_pkt, clip_pkt);
return _seek_internal(bd, clip, out_pkt, clip_pkt);
}
return bd->s_pos;
}
int64_t bd_chapter_pos(BLURAY *bd, int chapter)
......@@ -407,10 +412,15 @@ int64_t bd_seek_mark(BLURAY *bd, int mark)
uint32_t clip_pkt, out_pkt;
NAV_CLIP *clip;
// Find the closest access unit to the requested position
clip = nav_mark_search(bd->title, mark, &clip_pkt, &out_pkt);
if (mark < bd->title->mark_list.count) {
// Find the closest access unit to the requested position
clip = nav_mark_search(bd->title, mark, &clip_pkt, &out_pkt);
return _seek_internal(bd, clip, out_pkt, clip_pkt);
return _seek_internal(bd, clip, out_pkt, clip_pkt);
}
return bd->s_pos;
}
int64_t bd_seek(BLURAY *bd, uint64_t pos)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment