Mp3Info
Mp3Info copied to clipboard
Division by zero
DivisionByZeroError: Division by zero in ..\vendor\wapmorgan\mp3info\src\Mp3Info.php at line 425
Sample file: https://drive.google.com/open?id=11IrcdfEWlSTGwwXgf-yro2Hgjk3CV15M&usp=drive_fs
0.1.0
I experience the same problem!
Another one
DivisionByZeroError: Division by zero ...\vendor\wapmorgan\mp3info\src\Mp3Info.php:327
https://drive.google.com/open?id=13RITkPPiovgwDMefsBAPf7Zz8i4NohKW&usp=drive_fs
Same here: https://github.com/wapmorgan/Mp3Info/blob/master/src/Mp3Info.php#L323
Same with http://archives.bassdrivearchive.com/6%20-%20Saturday/Electronic%20Warfare%20-%20The%20Overfiend/%5b2023.03.11%5d%20Electronic%20Warfare%20-%20Overfiend.mp3
(File opened via url/http - not locally!)
PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in Mp3Info-0.1.0/src/Mp3Info.php:425
What I've traced so far:
-
$this->codecVersion
is2
. -
$header_bytes
are255, 247, 31, 219
(orFF F7 1F DB
) - the
($header_bytes[2] >> 2) & 0b11
turns into3
-
self::$_sampleRateTable[3]
isfalse
("reserved" according to spec) - therefore,
$this->sampleRate
gets set tofalse
which causes the DivisionByZeroError later
EDIT: A workaround for me seems to be checking $this->sampleRate
right after line 388, and if it turns out to be false
, just do a return null
. Which will make Mp3Info read the next frame. This issue might be related to #13 - just that the first frame is giving invalid data here.