Menu

#1 Division by zero; line 4031

open
nobody
None
5
2008-10-30
2008-10-30
Anonymous
No

Line 4031:
$speed = sprintf("%.2f",$bytes / (1024 * $duration));

If for some odd reason $duration is zero, this would crash the code with a 'division by zero' error.

Since the $speed calculation appears cosmetic anyway, I hastily provided the following fix, which appears to work:

if ( $duration > 0 ) {
$speed = sprintf("%.2f",$bytes / (1024 * $duration));
}
else {
$speed = "unknown";
}

//Provided by Mark Stingley
//cw3sting _AT_ yahoo.com

Discussion


Log in to post a comment.