[libbluray-devel] commit: Prevent segfault in clpi_lookup_spn when ii is decremented < 0 ( Robert McNamara )

git at videolan.org git at videolan.org
Thu Aug 19 23:22:37 CEST 2010


libbluray | branch: master | Robert McNamara <robert.mcnamara at gmail.com> | Fri Aug 20 00:21:07 2010 +0300| [bbed8f291e6dab1cbb0a46d3e15468460aef6bab] | committer: hpi1 

Prevent segfault in clpi_lookup_spn when ii is decremented < 0

Fixes segfault in user's Harry Potter and the Sorcerer's
Stone BD at start of playback.  ii was being decremented to -1 and caused a
segfault in

spn = (entry->coarse[ii].spn_ep & ~0x1FFFF) + entry->fine[jj].spn_ep;

(currently line 441)

Signed-off-by: hpi1 <hpi1 at anonymous.org>

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

 src/libbluray/bdnav/clpi_parse.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/libbluray/bdnav/clpi_parse.c b/src/libbluray/bdnav/clpi_parse.c
index 9bca392..68d5cdb 100644
--- a/src/libbluray/bdnav/clpi_parse.c
+++ b/src/libbluray/bdnav/clpi_parse.c
@@ -377,7 +377,7 @@ clpi_lookup_spn(CLPI_CL *cl, uint32_t timestamp, int before, uint8_t stc_id)
     }
     pts = ((uint64_t)(entry->coarse[ii].pts_ep & ~0x01) << 18) +
           ((uint64_t)entry->fine[ref].pts_ep << 8);
-    if (pts > timestamp) {
+    if (pts > timestamp && ii) {
         // The starting point and desired PTS is in the previous coarse entry
         ii--;
         coarse_pts = (uint32_t)(entry->coarse[ii].pts_ep & ~0x01) << 18;



More information about the libbluray-devel mailing list