JamesHeinrich / getID3

http://www.getid3.org/
Other
1.16k stars 246 forks source link

do not crash on empty seconds in DSS module #434

Closed jmper closed 10 months ago

jmper commented 10 months ago

I have had several DSS/DS2 files that caused '[TypeError] mktime(): Argument https://github.com/JamesHeinrich/getID3/pull/3 ($second) must be of type ?int, string given' in module.audio.dss.php in DSSdateStringToUnixDate() function. After analyzing I found out that the files did not have seconds value in their creation date. So substr returned empty string and empty string passed to mktime() causes TypeError, at least in PHP 8.1 and later. I have enclosed all substrings in DSSdateStringToUnixDate() with int() so they are always converted to integers, empty strings to zeros, and mktime() expects integers so it should be more or less correct.