JamesHeinrich / getID3

http://www.getid3.org/
Other
1.15k stars 245 forks source link

Fix an error when scanning WAV file via an externally opened file pointer #298

Closed paulijar closed 3 years ago

paulijar commented 3 years ago

The problem fixed by this PR is similar to the one reported earlier in https://github.com/JamesHeinrich/getID3/issues/242. The problem was fixed for MP3 and several other file types in 276fd3e5 but the WAV files were missed at that time. Since then, also support for DSDIFF files has been added with the same problem.

To recap, the problem case is when the file being analyzed is passed to getID3 as a file pointer without giving a fully qualified file path. When the file type specific module then spawns a secondary instance of getID3, it has to pass it also the filesize given by the client application. If null is passed as filesize to getID3::openfile, then it tries to obtain the filesize from the system using the filename. But this will fail if the filename is not fully qualified.

For the very least, the failing attempt to read the file size causes an error message like Error: filesize(): stat failed for /username/path/to/song/17 Chanson d'Automne.wav at /var/www/nextcloud/apps/music/3rdparty/getID3/getid3/getid3.php#468 to be logged. But probably it may cause also more severe issues, depending on the used PHP and/or server configuration.

Here is a related application issue: https://github.com/owncloud/music/issues/837