[libbluray-devel] [PATCH] Prevent segfault in clpi_lookup_spn when ii is decremented < 0

Robert McNamara robert.mcnamara at gmail.com
Thu Aug 19 00:01:21 CEST 2010


Patch enclosed.  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)

---
 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;
-- 
1.7.0.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libbluray-devel/attachments/20100818/1ca25ceb/attachment.htm>


More information about the libbluray-devel mailing list