[libbluray-devel] [Git][videolan/libbluray][master] 5 commits: clpi_find_stc_spn(): add missing lower bound for stc_id

Petri Hintukainen (@hpi) gitlab at videolan.org
Thu Aug 6 12:10:55 UTC 2026



Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
9be605a5 by Petri Hintukainen at 2026-08-05T20:20:39+03:00
clpi_find_stc_spn(): add missing lower bound for stc_id

Reported-by: Dominik Riedweg <domi.riedweg at gmail.com>

- - - - -
c185c9b0 by Petri Hintukainen at 2026-08-05T20:25:58+03:00
_parse_ep_map_stream(): clamp ref_ep_fine_id to num_ep_fine

Reported-by: Dominik Riedweg <domi.riedweg at gmail.com>

- - - - -
734e1bb8 by Petri Hintukainen at 2026-08-05T20:38:52+03:00
clpi_access_point(): Check num_stream_entry is > 0 before accessing table at [0].

Reported-by: Dominik Riedweg <domi.riedweg at gmail.com>

- - - - -
f69ecfc3 by Petri Hintukainen at 2026-08-05T20:47:21+03:00
clpi_lookup_spn(): check if ep_fine table is empty before using it

As is done in clpi_access_point()

Reported-by: Dominik Riedweg <domi.riedweg at gmail.com>

- - - - -
64bcf07f by Petri Hintukainen at 2026-08-06T14:56:14+03:00
NPTRate: make constructor package-private

- - - - -


2 changed files:

- src/libbluray/bdj/java/org/dvb/dsmcc/NPTRate.java
- src/libbluray/bdnav/clpi_parse.c


Changes:

=====================================
src/libbluray/bdj/java/org/dvb/dsmcc/NPTRate.java
=====================================
@@ -24,7 +24,7 @@ import java.io.Serializable;
 public class NPTRate implements Serializable {
 
     // should only be called internally
-    public NPTRate(int numerator, int denominator) {
+    NPTRate(int numerator, int denominator) {
         this.numerator = numerator;
         this.denominator = denominator;
     }


=====================================
src/libbluray/bdnav/clpi_parse.c
=====================================
@@ -338,6 +338,12 @@ _parse_ep_map_stream(BITSTREAM *bits, CLPI_EP_MAP_ENTRY *ee)
     }
     for (ii = 0; ii < ee->num_ep_coarse; ii++) {
         coarse[ii].ref_ep_fine_id = bs_read(bits, 18);
+        if (coarse[ii].ref_ep_fine_id >= ee->num_ep_fine) {
+            BD_DEBUG(DBG_HDMV | DBG_CRIT, "clpi_parse: invalid EP fine reference %u\n", coarse[ii].ref_ep_fine_id);
+            if (ee->num_ep_fine > 0) {
+                coarse[ii].ref_ep_fine_id = ee->num_ep_fine - 1;
+            }
+        }
         coarse[ii].pts_ep         = bs_read(bits, 14);
         coarse[ii].spn_ep         = bs_read(bits, 32);
     }
@@ -426,7 +432,8 @@ clpi_find_stc_spn(const CLPI_CL *cl, uint8_t stc_id)
 
     for (ii = 0; ii < cl->sequence.num_atc_seq; ii++) {
         atc = &cl->sequence.atc_seq[ii];
-        if (stc_id < atc->offset_stc_id + atc->num_stc_seq) {
+        if (stc_id >= atc->offset_stc_id &&
+            stc_id < atc->offset_stc_id + atc->num_stc_seq) {
             return atc->stc_seq[stc_id - atc->offset_stc_id].spn_stc_start;
         }
     }
@@ -457,6 +464,13 @@ clpi_lookup_spn(const CLPI_CL *cl, uint32_t timestamp, int before, uint8_t stc_i
     // Assumes that there is only one pid of interest
     entry = &cpi->entry[0];
 
+    if (entry->num_ep_fine < 1) {
+        if (before) {
+            return 0;
+        }
+        return cl->clip.num_source_packets;
+    }
+
     // Use sequence info to find spn_stc_start before doing
     // PTS search. The spn_stc_start defines the point in
     // the EP map to start searching.
@@ -552,6 +566,11 @@ clpi_access_point(const CLPI_CL *cl, uint32_t pkt, int next, int angle_change, u
     int start, end;
     int ref;
 
+    if (cpi->num_stream_pid < 1 || !cpi->entry) {
+        *time = 0;
+        return 0;
+    }
+
     // Assumes that there is only one pid of interest
     entry = &cpi->entry[0];
 



View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/eb96f03937d35bf9d91a2866f81926a12a7b648f...64bcf07f47452fb4724eef3febc40aaf7720d42a

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/eb96f03937d35bf9d91a2866f81926a12a7b648f...64bcf07f47452fb4724eef3febc40aaf7720d42a
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the libbluray-devel mailing list