[libbluray-devel] [Git][videolan/libbluray][master] 3 commits: Sanity-check playlist number
Petri Hintukainen (@hpi)
gitlab at videolan.org
Wed Oct 5 15:00:41 UTC 2022
Petri Hintukainen pushed to branch master at VideoLAN / libbluray
Commits:
9edad44f by Petri Hintukainen at 2022-10-05T17:55:53+03:00
Sanity-check playlist number
- - - - -
ea5d141c by Petri Hintukainen at 2022-10-05T17:56:37+03:00
Simplify
- - - - -
5539addb by Petri Hintukainen at 2022-10-05T17:57:26+03:00
Simplify
- - - - -
2 changed files:
- src/libbluray/bdj/java/java/io/BDFileSystem.java
- src/libbluray/bluray.c
Changes:
=====================================
src/libbluray/bdj/java/java/io/BDFileSystem.java
=====================================
@@ -209,7 +209,7 @@ public abstract class BDFileSystem extends FileSystem {
String resolvedPath = fs.resolve(parent, child);
String cachePath = BDJLoader.getCachedFile(resolvedPath);
- if (cachePath != resolvedPath && !cachePath.equals(resolvedPath)) {
+ if (!cachePath.equals(resolvedPath)) {
logger.info("resolve(p,c): using cached " + cachePath + " (" + resolvedPath + ")");
}
return cachePath;
@@ -251,7 +251,7 @@ public abstract class BDFileSystem extends FileSystem {
String resolvedPath = fs.resolve(f);
String cachePath = BDJLoader.getCachedFile(resolvedPath);
- if (cachePath != resolvedPath && !cachePath.equals(resolvedPath)) {
+ if (!cachePath.equals(resolvedPath)) {
logger.info("resolve(f): using cached " + cachePath + " (" + resolvedPath + ")");
}
return cachePath;
@@ -263,7 +263,7 @@ public abstract class BDFileSystem extends FileSystem {
String canonPath = fs.canonicalize(path);
String cachePath = BDJLoader.getCachedFile(canonPath);
- if (cachePath != canonPath && !cachePath.equals(canonPath)) {
+ if (!cachePath.equals(canonPath)) {
logger.info("canonicalize(): Using cached " + cachePath + " for " + canonPath + "(" + path + ")");
}
return cachePath;
=====================================
src/libbluray/bluray.c
=====================================
@@ -2820,11 +2820,20 @@ static BLURAY_TITLE_INFO* _fill_title_info(NAV_TITLE* title, uint32_t title_idx,
return NULL;
}
-static BLURAY_TITLE_INFO *_get_title_info(BLURAY *bd, uint32_t title_idx, uint32_t playlist, const char *mpls_name,
- unsigned angle)
+static BLURAY_TITLE_INFO *_get_mpls_info(BLURAY *bd, uint32_t title_idx, uint32_t playlist, unsigned angle)
{
NAV_TITLE *title;
BLURAY_TITLE_INFO *title_info;
+ char mpls_name[11];
+
+ if (playlist > 99999) {
+ BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Invalid playlist %u!\n", playlist);
+ return NULL;
+ }
+
+ if (snprintf(mpls_name, sizeof(mpls_name), "%05u.mpls", playlist) != 10) {
+ return NULL;
+ }
/* current title ? => no need to load mpls file */
bd_mutex_lock(&bd->mutex);
@@ -2849,7 +2858,6 @@ static BLURAY_TITLE_INFO *_get_title_info(BLURAY *bd, uint32_t title_idx, uint32
BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx, unsigned angle)
{
- char mpls_name[11] = "";
int mpls_id = -1;
bd_mutex_lock(&bd->mutex);
@@ -2860,7 +2868,6 @@ BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx, unsigned an
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "Invalid title index %d!\n", title_idx);
} else {
mpls_id = bd->title_list->title_info[title_idx].mpls_id;
- memcpy(mpls_name, bd->title_list->title_info[title_idx].name, 11);
}
bd_mutex_unlock(&bd->mutex);
@@ -2868,24 +2875,12 @@ BLURAY_TITLE_INFO* bd_get_title_info(BLURAY *bd, uint32_t title_idx, unsigned an
if (mpls_id < 0)
return NULL;
- return _get_title_info(bd, title_idx, mpls_id, mpls_name, angle);
+ return _get_mpls_info(bd, title_idx, mpls_id, angle);
}
BLURAY_TITLE_INFO* bd_get_playlist_info(BLURAY *bd, uint32_t playlist, unsigned angle)
{
- char *f_name;
- BLURAY_TITLE_INFO *title_info;
-
- f_name = str_printf("%05d.mpls", playlist);
- if (!f_name) {
- return NULL;
- }
-
- title_info = _get_title_info(bd, 0, playlist, f_name, angle);
-
- X_FREE(f_name);
-
- return title_info;
+ return _get_mpls_info(bd, 0, playlist, angle);
}
void bd_free_title_info(BLURAY_TITLE_INFO *title_info)
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/eb51ac1e56adf55b8197a99e9961fcc71c167fcf...5539addbbf8c26d756fc2cb76b3919f8b73be66a
--
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/eb51ac1e56adf55b8197a99e9961fcc71c167fcf...5539addbbf8c26d756fc2cb76b3919f8b73be66a
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the libbluray-devel
mailing list