Opened 17 years ago

Closed 17 years ago

#4838 closed defect (fixed)

make sure dvdcss_version always has something in it. Even if it isn't found.

Reported by: Erik Hovland <erik@…> Owned by: Isaac Richards
Priority: minor Milestone: 0.22
Component: mythtv Version: 0.21-fixes
Severity: low Keywords:
Cc: Ticket locked: no

Description

The dvdcss_version string is extracted from the shared library. It might fail if the symbol is not found. That is fine. But in the code:

  if(dvdcss_library != NULL) {
    /*
    char *psz_method = getenv( "DVDCSS_METHOD" );
    char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
    fprintf(stderr, "DVDCSS_METHOD %s\n", psz_method);
    fprintf(stderr, "DVDCSS_VERBOSE %s\n", psz_verbose);
    */
    fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n",
            *dvdcss_version);

The dvdcss_version string might point to null and then printed out. Which wouldn't crash. But would be garbage.

Attachments (1)

libs_libmythdvdnav_dvd_input.c-make-sure-dvd_version-exists.patch (644 bytes) - added by Erik Hovland <erik@…> 17 years ago.
make sure dvdcss_version is set to something.

Download all attachments as: .zip

Change History (5)

Changed 17 years ago by Erik Hovland <erik@…>

make sure dvdcss_version is set to something.

comment:1 Changed 17 years ago by Isaac Richards

Milestone: 0.210.22

comment:2 Changed 17 years ago by Nigel

Close, but dvdcss_version is a pointer to a char pointer. I think something like this is needed:

% svn diff libs/libmythdvdnav/dvd_input.c
Index: libs/libmythdvdnav/dvd_input.c
===================================================================
--- libs/libmythdvdnav/dvd_input.c      (revision 16344)
+++ libs/libmythdvdnav/dvd_input.c      (working copy)
@@ -343,7 +343,7 @@
     fprintf(stderr, "DVDCSS_VERBOSE %s\n", psz_verbose);
     */
     fprintf(stderr, "libdvdread: Using libdvdcss version %s for DVD access\n",
-           *dvdcss_version);
+           dvdcss_version ? *dvdcss_version : "unknown");
     
     /* libdvdcss wrapper functions */
     dvdinput_open  = css_open;

comment:3 Changed 17 years ago by Erik Hovland <erik@…>

I like your fix better.

comment:4 Changed 17 years ago by Nigel

Resolution: fixed
Status: newclosed

(In [16360]) Check for bad libdvdcss version. Based on patch by Erik Hovland. Closes #4838

Note: See TracTickets for help on using tickets.