Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Division by zero #30

Open
painbaker opened this issue Jun 22, 2023 · 4 comments
Open

Division by zero #30

painbaker opened this issue Jun 22, 2023 · 4 comments

Comments

@painbaker
Copy link

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
Copy link

I experience the same problem!

@painbaker
Copy link
Author

Another one

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

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

@painbaker
Copy link
Author

@mbirth
Copy link

mbirth commented Feb 25, 2024

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 is 2.
  • $header_bytes are 255, 247, 31, 219 (or FF F7 1F DB)
  • the ($header_bytes[2] >> 2) & 0b11 turns into 3
  • self::$_sampleRateTable[3] is false ("reserved" according to spec)
  • therefore, $this->sampleRate gets set to false 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants