ARudik / php-reader

Automatically exported from code.google.com/p/php-reader
0 stars 0 forks source link

Warning "Division by zero", Error "Size cannot be negative" #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi!

With some MP3 files appears a warning "Division by zero" on line 255 in 
/Media/Mpeg/Abs/Frame.php.

Code to reproduce:

<?php

require_once 'Zend/Media/Mpeg/Abs.php';
$path = "/Music/Errorneus/File1.mp3";
try {
  $abs = new Zend_Media_Mpeg_Abs($path);
}
catch(Exception $e) {
  echo "<font color=red><b>$path:</b> ".$e->getMessage()."</font><br/><br/>";       
}

?>

Original issue reported on code.google.com by bobrovni...@gmail.com on 26 Sep 2010 at 8:11

Attachments:

GoogleCodeExporter commented 9 years ago
Also an error "Size cannot be negative" gives File2.mp3

Original comment by bobrovni...@gmail.com on 26 Sep 2010 at 8:20

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for reporting! I will have a look as soon as possible!

Original comment by svollbehr on 27 Sep 2010 at 6:19

GoogleCodeExporter commented 9 years ago

Original comment by svollbehr on 28 Dec 2010 at 10:44

GoogleCodeExporter commented 9 years ago
I have now completed the analysis. The errors are due to invalid file content.

File1.mp3 contains ABS within RIFF chunk, which is currently not supported by 
the class (basically you've got a WAV file with MP3 encoding there). I will 
work on a solution for this.

File2.mp3 contains errorneusly two sequential ID3 tags at the beginning of the 
file and the ABS stream does not begin right after the first tag as expected 
(and hence the error). Someone else got the same error earlier as well thus I 
have now changed the Zend_Media_Mpeg_Abs code to skip any number of ID3 tags in 
the beginning of the file. I will commit the changes shortly into trunk.

The Zend_Media_Mpeg_Abs class now also informs the user clearly of invalid 
files by throwing an exception.

Original comment by svollbehr on 28 Dec 2010 at 12:10

GoogleCodeExporter commented 9 years ago
I made changes to Zend_Media_Mpeg_Abs class so that it can now handle both 
abovementioned cases (MPEG ABS within RIFF chunk and multiple ID3v2 tags). 
Changes are committed to trunk.

Let me know if you encounter any further errors and thanks for reporting these 
ones!!

Original comment by svollbehr on 28 Dec 2010 at 1:50