summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2016-07-11 17:03:03 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2016-07-11 17:03:03 +0000
commitf280a87c6609384fc2b962b27c1f9d3ac4a39150 (patch)
treee4de544d489825d766d67e22e13790ce82a59358 /libmysqld
parentae511cbe387fdc16bf48b4fccc889d6d5d256d76 (diff)
downloadmariadb-git-f280a87c6609384fc2b962b27c1f9d3ac4a39150.tar.gz
MDEV-10318 : Fix crash in embedded, in case prepared statement has parameter placeholders, but does not bind parameters
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/lib_sql.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index a313c624078..63424af27f6 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -333,6 +333,12 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
THD *thd;
my_bool res;
+ if (stmt->param_count && !stmt->bind_param_done)
+ {
+ set_stmt_error(stmt, CR_PARAMS_NOT_BOUND, unknown_sqlstate, NULL);
+ DBUG_RETURN(1);
+ }
+
int4store(header, stmt->stmt_id);
header[4]= (uchar) stmt->flags;
thd= (THD*)stmt->mysql->thd;