From: Andrey Hristov Date: Fri, 18 Sep 2009 14:32:01 +0000 (+0000) Subject: Fix for bug#48909 Segmentation fault in mysqli_stmt_execute X-Git-Tag: php-5.4.0alpha1~191^2~2642 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=528e66fbf588eaf1014b5ba355f194d9890afd36;p=php Fix for bug#48909 Segmentation fault in mysqli_stmt_execute --- diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 72301d3fa9..8b4d7a1827 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -741,7 +741,7 @@ PHP_FUNCTION(mysqli_stmt_execute) for (i = 0; i < stmt->param.var_cnt; i++) { for (j = i + 1; j < stmt->param.var_cnt; j++) { /* Oops, someone binding the same variable - clone */ - if (stmt->param.vars[j] == stmt->param.vars[i]) { + if (stmt->param.vars[j] == stmt->param.vars[i] && stmt->param.vars[i]) { php_mysqli_stmt_copy_it(&copies, stmt->param.vars[i], stmt->param.var_cnt, i); break; } diff --git a/ext/mysqli/tests/bug48909.phpt b/ext/mysqli/tests/bug48909.phpt new file mode 100644 index 0000000000..d34e6cd2a8 --- /dev/null +++ b/ext/mysqli/tests/bug48909.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #48909 (Segmentation fault in mysqli_stmt_execute) +--SKIPIF-- + +--FILE-- +prepare("insert into test values (?,?)"); + var_dump($stmt->bind_param("bb",$bvar,$bvar)); + var_dump($stmt->execute()); + $stmt->close(); + $link->close(); + echo "done"; +?> +--EXPECTF-- +bool(true) +bool(true) +done