diff --git a/ChangeLog b/ChangeLog index 1ef4e6717..c00e89a24 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - ChangeLog $Id$ $Source$ +2006-09-23 Marc Delisle + * libraries/common.lib.php: bug #1519859, avoid overflow on 64-bit machines + 2006-09-22 Marc Delisle * libraries/tbl_properties_links.inc.php: bug #1560152, after renaming a table the navigation does not work diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 0143f1cc9..017874a21 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1534,7 +1534,8 @@ window.parent.updateTableTitle('', '= 1; $d--, $ex-=3) { if (isset($GLOBALS['byteUnits'][$d]) && $value >= $li * pow(10, $ex)) { - $value = round($value / (pow(1024, $d) / $dh)) /$dh; + // use 1024.0 to avoid integer overflow on 64-bit machines + $value = round($value / (pow(1024.0, $d) / $dh)) /$dh; $unit = $GLOBALS['byteUnits'][$d]; break 1; } // end if @@ -1623,16 +1624,16 @@ window.parent.updateTableTitle('', '= 1) { for ($d = 8; $d >= 0; $d--) { - if (isset($units[$d]) && $value >= $li * pow(1000, $d-1)) { - $value = round($value / (pow(1000, $d) / $dh)) /$dh; + if (isset($units[$d]) && $value >= $li * pow(1000.0, $d-1)) { + $value = round($value / (pow(1000.0, $d) / $dh)) /$dh; $unit = $units[$d]; break 1; } // end if } // end for } elseif (!$only_down && (float) $value !== 0.0) { for ($d = -8; $d <= 8; $d++) { - if (isset($units[$d]) && $value <= $li * pow(1000, $d-1)) { - $value = round($value / (pow(1000, $d) / $dh)) /$dh; + if (isset($units[$d]) && $value <= $li * pow(1000.0, $d-1)) { + $value = round($value / (pow(1000.0, $d) / $dh)) /$dh; $unit = $units[$d]; break 1; } // end if