From cd421e018c29b7ffbf85a1eb6c80c2435f8487cd Mon Sep 17 00:00:00 2001 From: Dmitriy Buldakov Date: Sat, 20 Jul 2013 10:18:02 -0400 Subject: [PATCH 1/2] Bug #4012 Crash on CSV file import --- libraries/import.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/import.lib.php b/libraries/import.lib.php index aa15847a6e..81e5f2f68b 100644 --- a/libraries/import.lib.php +++ b/libraries/import.lib.php @@ -565,7 +565,7 @@ function PMA_getDecimalSize(&$cell) * @todo Handle the error cases more elegantly */ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, - $curr_type, &$cell + $curr_type, $cell ) { $curr_size = strlen((string)$cell); @@ -763,7 +763,7 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, * (VARCHAR or INT or BIGINT or DECIMAL or NONE) * @access public */ -function PMA_detectType($last_cumulative_type, &$cell) +function PMA_detectType($last_cumulative_type, $cell) { /** * If numeric, determine if decimal, int or bigint From 6ac33adc1523139d7e8d10203fd77089d5507b67 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 20 Jul 2013 10:23:20 -0400 Subject: [PATCH 2/2] ChangeLog entry for bug 4012 fix Fix another case of parameter incorrectly passed by reference Adjust functions parameter doc --- ChangeLog | 1 + libraries/import.lib.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index eace936295..9f20ec7471 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ phpMyAdmin - ChangeLog - bug Incorrect Drizzle 7 detection - bug #4019 Create database if not exists (export): add an option to the interface to enable generating CREATE DATABASE and USE (false by default) +- bug #4012 Crash on CSV file import 4.0.4.1 (2013-06-30) - [security] Global variables scope injection vulnerability (see PMASA-2013-7) diff --git a/libraries/import.lib.php b/libraries/import.lib.php index 81e5f2f68b..919b92ff97 100644 --- a/libraries/import.lib.php +++ b/libraries/import.lib.php @@ -531,13 +531,13 @@ function PMA_getD($last_cumulative_size) /** * Obtains the decimal size of a given cell * - * @param string &$cell cell content + * @param string $cell cell content * * @return array Contains the precision, scale, and full size * representation of the given decimal cell * @access public */ -function PMA_getDecimalSize(&$cell) +function PMA_getDecimalSize($cell) { $curr_size = strlen((string)$cell); $decPos = strpos($cell, "."); @@ -557,7 +557,7 @@ function PMA_getDecimalSize(&$cell) * (NONE or VARCHAR or DECIMAL or INT or BIGINT) * @param int $curr_type Type of the current cell * (NONE or VARCHAR or DECIMAL or INT or BIGINT) - * @param string &$cell The current cell + * @param string $cell The current cell * * @return string Size of the given cell in the type-appropriate format * @access public @@ -756,7 +756,7 @@ function PMA_detectSize($last_cumulative_size, $last_cumulative_type, * * @param int $last_cumulative_type Last cumulative column type * (VARCHAR or INT or BIGINT or DECIMAL or NONE) - * @param string &$cell String representation of the cell for which + * @param string $cell String representation of the cell for which * a best-fit type is to be determined * * @return int The MySQL type representation