[libbluray-devel] Fix an issue with unchecked st->clip

Alexander Roalter git at videolan.org
Thu Aug 16 12:14:26 CEST 2012


libbluray | branch: master | Alexander Roalter <alexander at roalter.it> | Wed Aug 15 19:41:21 2012 +0200| [51d6724f2b520d502221e6b08a500ad2825897dd] | committer: Jean-Baptiste Kempf

Fix an issue with unchecked st->clip

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

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

diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 1824a64..2236b40 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1361,15 +1361,15 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
                     }
                 }
             }
+            if (st->clip == NULL) {
+                // We previously reached the last clip.  Nothing
+                // else to read.
+                _queue_event(bd, (BD_EVENT){BD_EVENT_END_OF_TITLE, 0});
+                return 0;
+            }
             if (st->int_buf_off == 6144 || clip_pkt >= st->clip->end_pkt) {
 
                 // Do we need to get the next clip?
-                if (st->clip == NULL) {
-                    // We previously reached the last clip.  Nothing
-                    // else to read.
-                    _queue_event(bd, (BD_EVENT){BD_EVENT_END_OF_TITLE, 0});
-                    return 0;
-                }
                 if (clip_pkt >= st->clip->end_pkt) {
 
                     // split read()'s at clip boundary



More information about the libbluray-devel mailing list