[libbluray-devel] Fix crash in _find_*_stream() when stream PSR is changed after playlist end

hpi1 git at videolan.org
Fri Jun 13 21:29:14 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Jun 13 22:18:18 2014 +0300| [f4e4bd7960802008b6d80ff0699278fe311dcc9f] | committer: hpi1

Fix crash in _find_*_stream() when stream PSR is changed after playlist end

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=f4e4bd7960802008b6d80ff0699278fe311dcc9f
---

 src/libbluray/bluray.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 2a103d8..8b231e3 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -421,7 +421,7 @@ static void _update_chapter_psr(BLURAY *bd)
 
 static int _find_pg_stream(BLURAY *bd, uint16_t *pid, int *sub_path_idx, unsigned *sub_clip_idx, uint8_t *char_code)
 {
-    unsigned  main_clip_idx = bd->st0.clip->ref;
+    unsigned  main_clip_idx = bd->st0.clip ? bd->st0.clip->ref : 0;
     MPLS_PI  *pi        = &bd->title->pl->play_item[main_clip_idx];
     unsigned  pg_stream = bd_psr_read(bd->regs, PSR_PG_STREAM);
 
@@ -1999,7 +1999,7 @@ static int _preload_textst_subpath(BLURAY *bd)
 
 static int _find_ig_stream(BLURAY *bd, uint16_t *pid, int *sub_path_idx, unsigned *sub_clip_idx)
 {
-    unsigned  main_clip_idx = bd->st0.clip->ref;
+    unsigned  main_clip_idx = bd->st0.clip ? bd->st0.clip->ref : 0;
     MPLS_PI  *pi        = &bd->title->pl->play_item[main_clip_idx];
     unsigned  ig_stream = bd_psr_read(bd->regs, PSR_IG_STREAM_ID);
 
@@ -2762,11 +2762,13 @@ static void _process_psr_change_event(BLURAY *bd, BD_PSR_EVENT *ev)
             }
 
             bd_mutex_lock(&bd->mutex);
+            if (bd->st0.clip) {
             _init_pg_stream(bd);
             if (bd->st_textst.clip) {
                 BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Changing TextST stream\n");
                 _preload_textst_subpath(bd);
             }
+            }
             bd_mutex_unlock(&bd->mutex);
 
             break;



More information about the libbluray-devel mailing list