[libbluray-devel] Check few TS sync bytes if block is marked encrypted ( do not trust only TP extra header).

hpi1 git at videolan.org
Sun Feb 3 00:06:56 CET 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Feb  3 00:30:34 2013 +0200| [4c8033d529dbf2dd4113077325e43114fbd8fd1b] | committer: hpi1

Check few TS sync bytes if block is marked encrypted (do not trust only TP extra header).

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

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

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 2665296..eb7473f 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -532,10 +532,13 @@ static int _read_block(BLURAY *bd, BD_STREAM *st, uint8_t *buf)
 
                 /* Check TP_extra_header Copy_permission_indicator. If != 0, unit is still encrypted. */
                 if (buf[0] & 0xc0) {
-                    BD_DEBUG(DBG_BLURAY | DBG_CRIT,
-                          "TP header copy permission indicator != 0, unit is still encrypted? (%p)\n", bd);
-                    _queue_event(bd, BD_EVENT_ENCRYPTED, 0);
-                    return -1;
+                    /* check first TS sync bytes */
+                    if (buf[4] != 0x47 || buf[4+192] != 0x47 || buf[4+2*192] != 0x47) {
+                        BD_DEBUG(DBG_BLURAY | DBG_CRIT,
+                                 "TP header copy permission indicator != 0, unit is still encrypted? (%p)\n", bd);
+                        _queue_event(bd, BD_EVENT_ENCRYPTED, 0);
+                        return -1;
+                    }
                 }
 
                 BD_DEBUG(DBG_STREAM, "Read unit OK! (%p)\n", bd);



More information about the libbluray-devel mailing list