[libbluray-devel] HDMV: detect infinite looping between graphics controller and HDMV VM

hpi1 git at videolan.org
Mon Feb 9 13:02:32 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Feb  9 13:55:14 2015 +0200| [60c023f3056caf47a9ca566c387ec619186c4967] | committer: hpi1

HDMV: detect infinite looping between graphics controller and HDMV VM

Fixes live lock with "Butterfly on the Wheel" by aborting playback.
The disc is broken:
UO mask allows jumping to root menu from language selection menu.
This skips on-disc menu initialization code, causing infinite loop
in root menu.

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

 ChangeLog              |    2 ++
 src/libbluray/bluray.c |   11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index f3b0a1e..c72545b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+- Fix infinite loop with some broken HDMV menus
+
 2015-01-26: Version 0.7.0
 - Add player setting for BD-J persistent storage and cache paths.
 - Add support for system fonts. BD-J fonts in jre/lib/fonts/ are not required anymore.
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 8ec1fb0..37cb198 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -3169,6 +3169,7 @@ static int _read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event)
     /* run HDMV VM ? */
     if (bd->title_type == title_hdmv) {
 
+        int loops = 0;
         while (!bd->hdmv_suspended) {
 
             if (_run_hdmv(bd) < 0) {
@@ -3176,6 +3177,16 @@ static int _read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event)
                 bd->title_type = title_undef;
                 return -1;
             }
+            if (loops++ > 100) {
+                /* Detect infinite loops.
+                 * Broken disc may cause infinite loop between graphics controller and HDMV VM.
+                 * This happens ex. with "Butterfly on a Wheel":
+                 * Triggering unmasked "Menu Call" UO in language selection menu skips
+                 * menu system initialization code, resulting in infinite loop in root menu.
+                 */
+                BD_DEBUG(DBG_BLURAY | DBG_CRIT, "bd_read_ext(): detected possible HDMV mode live lock (%d loops)\n", loops);
+                _queue_event(bd, BD_EVENT_ERROR, BD_ERROR_HDMV);
+            }
             if (_get_event(bd, event)) {
                 return 0;
             }



More information about the libbluray-devel mailing list