[libdvdnav-devel] [Git][videolan/libdvdread][master] 4 commits: dvd_reader: bound the directory path formatting
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Tue Aug 11 20:29:29 UTC 2026
Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdread
Commits:
5bfb2efc by Jean-Baptiste Kempf at 2026-08-11T22:28:54+02:00
dvd_reader: bound the directory path formatting
findDVDFile builds a fallback path with sprintf("%s/%s/", path_root,
subdir) into a PATH_MAX+1 buffer. path_root comes from the caller's
directory and is never length-checked, so a near-PATH_MAX path overflows
the stack buffer by the length of the subdirectory. Use snprintf, like
the sibling path building already does.
The two lines were rewritten in 2a6d7b9 (the unbounded write itself is
older).
Fixes: 2a6d7b9bf751 ("findDVDFile: allow selecting the zone directory explicitly")
Co-Authored-By: Claude Fable 5 <noreply at anthropic.com>
- - - - -
b4096286 by Jean-Baptiste Kempf at 2026-08-11T22:28:54+02:00
dvd_reader: match zone directory prefixes case-insensitively
DVDFileZone classifies a file into its decryption zone by prefix, but
used case-sensitive strncmp while findDVDFile locates the same files with
strncasecmp. A lowercase zone directory (e.g. /video_ts/) was therefore
found on disc but classified as the fallback disc type, selecting the
wrong decryption scheme on a hybrid disc. Match findDVDFile.
Fixes: d6f94f7afa84 ("Support hybrid discs whose ATS borrows a video title set")
Co-Authored-By: Claude Fable 5 <noreply at anthropic.com>
- - - - -
4ffa5c65 by Jean-Baptiste Kempf at 2026-08-11T22:28:54+02:00
dvd_reader: log the borrowed VTS in DVDFileStat too
DVDOpenFile logs when a hybrid audio title set falls back to a video
title set's VOBs, but DVDFileStat did the same fallback silently. Emit
the matching message so stat and open report the disc the same way.
Fixes: d6f94f7afa84 ("Support hybrid discs whose ATS borrows a video title set")
Co-Authored-By: Claude Fable 5 <noreply at anthropic.com>
- - - - -
8ddc0b4a by Jean-Baptiste Kempf at 2026-08-11T22:28:54+02:00
dvd_reader: use %02d for the title VOB path like its siblings
The hybrid title-VOB path builder formatted the title and part with %02i
and %i while the other six title-VOB builders use %02d and %d. The output
is identical; match the siblings for consistency.
Fixes: d6f94f7afa84 ("Support hybrid discs whose ATS borrows a video title set")
Co-Authored-By: Claude Fable 5 <noreply at anthropic.com>
- - - - -
1 changed file:
- src/dvd_reader.c
Changes:
=====================================
src/dvd_reader.c
=====================================
@@ -862,11 +862,11 @@ void DVDClose( dvd_reader_t *dvd )
* disc is not always the zone implied by the disc type. */
static dvd_type_t DVDFileZone( dvd_reader_t *ctx, const char *filename )
{
- if( !strncmp( filename, "/VIDEO_TS/", 10 ) )
+ if( !strncasecmp( filename, "/VIDEO_TS/", 10 ) )
return DVD_V;
- if( !strncmp( filename, "/AUDIO_TS/", 10 ) )
+ if( !strncasecmp( filename, "/AUDIO_TS/", 10 ) )
return DVD_A;
- if( !strncmp( filename, "/DVD_RTAV/", 10 ) )
+ if( !strncasecmp( filename, "/DVD_RTAV/", 10 ) )
return DVD_VR;
return ctx->dvd_type;
}
@@ -987,14 +987,14 @@ static int findDVDFile( dvd_reader_t *dvd, const char *file, char *filename )
int i;
/* Try also with adding the path, just in case. */
- sprintf( video_path, "%s/%s/", dvd->rd->path_root, subdir );
+ snprintf( video_path, sizeof(video_path), "%s/%s/", dvd->rd->path_root, subdir );
ret = findDirFile( dvd, video_path, nodirfile, filename );
if( ret < 0 ) {
/* Try with the path, but in lower case. */
for( i = 0; subdir[ i ]; i++ )
lower[ i ] = tolower( (unsigned char)subdir[ i ] );
lower[ i ] = '\0';
- sprintf( video_path, "%s/%s/", dvd->rd->path_root, lower );
+ snprintf( video_path, sizeof(video_path), "%s/%s/", dvd->rd->path_root, lower );
ret = findDirFile( dvd, video_path, nodirfile, filename );
if( ret < 0 ) {
return 0;
@@ -1278,7 +1278,7 @@ static dvd_file_t *DVDOpenVOBPath( dvd_reader_t *ctx, int title, int menu,
/* the zone directory matters when opening a title set of the other
* zone of a hybrid disc */
- sprintf( filename, "/%s_TS/%cTS_%02i_%i.%cOB", DVD_TYPE_STRING( ts_type ),
+ sprintf( filename, "/%s_TS/%cTS_%02d_%d.%cOB", DVD_TYPE_STRING( ts_type ),
STREAM_TYPE_STRING( ts_type ), title, i + 1 , STREAM_TYPE_STRING( ts_type ));
if( !findDVDFile( ctx, filename, full_path ) ) {
break;
@@ -1678,6 +1678,8 @@ int DVDFileStat( dvd_reader_t *reader, int titlenum,
if( ret < 0 && reader->dvd_type == DVD_A ) {
int vts = DVDAudioLinkedVTS( reader, titlenum );
if( vts > 0 ) {
+ Log2( reader, "ATS %02d has no AOBs, using the title VOBs of VTS %02d",
+ titlenum, vts );
if( dvd->isImageFile )
ret = DVDFileStatVOBUDF( reader, vts, 0, DVD_V, statbuf );
else
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/compare/5a93cda243f0d658003bfaf057b0431130615848...8ddc0b4a8bd149ed591e5468b3752d703ee223cf
--
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/compare/5a93cda243f0d658003bfaf057b0431130615848...8ddc0b4a8bd149ed591e5468b3752d703ee223cf
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 libdvdnav-devel
mailing list