diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-08-22 16:45:25 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-08-22 16:45:25 +0200 |
commit | f72a7659976089dc6f727bb31e8a91306199cf57 (patch) | |
tree | 0199cd1bf1c16b01b358ab88e5dce5b038349872 /sql-common | |
parent | ed06ba3492d55c9e9dde231b55352f854e5e4b50 (diff) | |
parent | 1fd8150a5b5e3f56aa3c253225929a07ee9a4026 (diff) | |
download | mariadb-git-f72a7659976089dc6f727bb31e8a91306199cf57.tar.gz |
5.2 merge.
two tests still fail:
main.innodb_icp and main.range_vs_index_merge_innodb
call records_in_range() with both range ends being open
(which triggers an assert)
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index ec294d2138d..19b1b86cfa5 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2003, 2010, Oracle and/or its affiliates. + Copyright (c) 2003, 2012, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1304,7 +1304,7 @@ static void cli_fetch_lengths(ulong *to, MYSQL_ROW column, ***************************************************************************/ MYSQL_FIELD * -unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, +unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, my_bool default_value, uint server_capabilities) { MYSQL_ROWS *row; @@ -1317,6 +1317,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, if (!result) { free_rows(data); /* Free old data */ + set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate); DBUG_RETURN(0); } bzero((char*) field, (uint) sizeof(MYSQL_FIELD)*fields); @@ -1344,6 +1345,14 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, field->org_name_length= lengths[5]; /* Unpack fixed length parts */ + if (lengths[6] != 12) + { + /* malformed packet. signal an error. */ + free_rows(data); /* Free old data */ + set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate); + DBUG_RETURN(0); + } + pos= (uchar*) row->data[6]; field->charsetnr= uint2korr(pos); field->length= (uint) uint4korr(pos+2); @@ -3423,7 +3432,7 @@ get_info: if (!(fields=cli_read_rows(mysql,(MYSQL_FIELD*)0, protocol_41(mysql) ? 7:5))) DBUG_RETURN(1); - if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc, + if (!(mysql->fields=unpack_fields(mysql, fields,&mysql->field_alloc, (uint) field_count,0, mysql->server_capabilities))) DBUG_RETURN(1); |