wapmorgan / Mp3Info

The fastest PHP library to extract mp3 meta information (duration, bitrate, samplerate and so on) and tags (id3v1, id3v2).
https://wapmorgan.github.io/Mp3Info/
GNU Lesser General Public License v3.0
139 stars 41 forks source link

Division by zero #30

Open painbaker opened 1 year ago

painbaker commented 1 year ago

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

jeroen-fonky commented 1 year ago

I experience the same problem!

painbaker commented 8 months ago

Another one

DivisionByZeroError: Division by zero ...\vendor\wapmorgan\mp3info\src\Mp3Info.php:327

https://drive.google.com/open?id=13RITkPPiovgwDMefsBAPf7Zz8i4NohKW&usp=drive_fs

painbaker commented 8 months ago

Same here: https://github.com/wapmorgan/Mp3Info/blob/master/src/Mp3Info.php#L323

mbirth commented 6 months ago

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:

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.