Commit a4cdb93b authored by mats@mysql.com's avatar mats@mysql.com

Merge mysql.com:/home/bkroot/mysql-4.0

into mysql.com:/home/bk/b8412-mysql-4.0
parents 30bf2820 d0f1b5f3
...@@ -24,6 +24,7 @@ bk@admin.bk ...@@ -24,6 +24,7 @@ bk@admin.bk
brian@brian-akers-computer.local brian@brian-akers-computer.local
carsten@tsort.bitbybit.dk carsten@tsort.bitbybit.dk
davida@isil.mysql.com davida@isil.mysql.com
dean@mysql.com
dellis@goetia.(none) dellis@goetia.(none)
dlenev@brandersnatch.localdomain dlenev@brandersnatch.localdomain
dlenev@build.mysql.com dlenev@build.mysql.com
......
...@@ -19,6 +19,13 @@ BK_STATUS=$BK_STATUS$BK_COMMIT ...@@ -19,6 +19,13 @@ BK_STATUS=$BK_STATUS$BK_COMMIT
if [ "$BK_STATUS" = OK ] if [ "$BK_STATUS" = OK ]
then then
HAS_ACTUAL_CHANGES=`bk cset -r+ -d | grep -v "^#"`
if [ "$HAS_ACTUAL_CHANGES" = "" ]
then
echo ChangeSet had no real changes, not sending emails
exit
fi
CHANGESET=`bk -R prs -r+ -h -d':P:::I:' ChangeSet` CHANGESET=`bk -R prs -r+ -h -d':P:::I:' ChangeSet`
BUG=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Bb][Uu][Gg] *# *\([0-9][0-9]*\).*$/\1/p'` BUG=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Bb][Uu][Gg] *# *\([0-9][0-9]*\).*$/\1/p'`
......
...@@ -23,18 +23,25 @@ ...@@ -23,18 +23,25 @@
#include <io.h> #include <io.h>
#include <malloc.h> #include <malloc.h>
#if defined(__NT__) #if defined(_WIN64) || defined(WIN64)
#define SYSTEM_TYPE "NT" #define SYSTEM_TYPE "Win64"
#elif defined(__WIN2000__) #elif defined(_WIN32) || defined(WIN32)
#define SYSTEM_TYPE "WIN2000" #define SYSTEM_TYPE "Win32"
#else #else
#define SYSTEM_TYPE "Win95/Win98" #define SYSTEM_TYPE "Windows"
#endif #endif
#if defined(_WIN64) || defined(WIN64) #if defined(_M_IA64)
#define MACHINE_TYPE "ia64" /* Define to machine type name */ #define MACHINE_TYPE "ia64"
#elif defined(_M_IX86)
#define MACHINE_TYPE "ia32"
#elif defined(_M_ALPHA)
#define MACHINE_TYPE "axp"
#else #else
#define MACHINE_TYPE "i32" /* Define to machine type name */ #define MACHINE_TYPE "unknown" /* Define to machine type name */
#endif
#if !(defined(_WIN64) || defined(WIN64))
#ifndef _WIN32 #ifndef _WIN32
#define _WIN32 /* Compatible with old source */ #define _WIN32 /* Compatible with old source */
#endif #endif
......
...@@ -205,6 +205,10 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query, ...@@ -205,6 +205,10 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
left_root_right)) left_root_right))
goto err2; goto err2;
/*
If ndocs == 0, this will not allocate RAM for FT_INFO.doc[],
so if ndocs == 0, FT_INFO.doc[] must not be accessed.
*/
dlist=(FT_INFO *)my_malloc(sizeof(FT_INFO)+ dlist=(FT_INFO *)my_malloc(sizeof(FT_INFO)+
sizeof(FT_DOC)*(aio.dtree.elements_in_tree-1), sizeof(FT_DOC)*(aio.dtree.elements_in_tree-1),
MYF(0)); MYF(0));
...@@ -275,7 +279,8 @@ float ft_nlq_find_relevance(FT_INFO *handler, ...@@ -275,7 +279,8 @@ float ft_nlq_find_relevance(FT_INFO *handler,
else else
a=c; a=c;
} }
if (docs[a].dpos == docid) /* bounds check to avoid accessing unallocated handler->doc */
if (a < handler->ndocs && docs[a].dpos == docid)
return (float) docs[a].weight; return (float) docs[a].weight;
else else
return 0.0; return 0.0;
......
...@@ -61,3 +61,12 @@ select * from t1; ...@@ -61,3 +61,12 @@ select * from t1;
a b a b
1 apple 1 apple
drop table t1; drop table t1;
CREATE TABLE t1 ( a int PRIMARY KEY );
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
INSERT INTO t1 VALUES (0),(1),(2);
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
SELECT * FROM t1;
a
0
2
DROP TABLE t1;
...@@ -315,3 +315,9 @@ select count(*) from t1; ...@@ -315,3 +315,9 @@ select count(*) from t1;
count(*) count(*)
1 1
drop table t1; drop table t1;
CREATE TABLE t1 ( a TEXT, FULLTEXT (a) );
INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance');
SELECT MATCH(a) AGAINST ('nosuchword') FROM t1;
MATCH(a) AGAINST ('nosuchword')
0
DROP TABLE t1;
...@@ -71,3 +71,14 @@ select * from t1; ...@@ -71,3 +71,14 @@ select * from t1;
delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a; delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a;
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# Bug #8392: delete with ORDER BY containing a direct reference to the table
#
CREATE TABLE t1 ( a int PRIMARY KEY );
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
INSERT INTO t1 VALUES (0),(1),(2);
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
SELECT * FROM t1;
DROP TABLE t1;
...@@ -252,3 +252,11 @@ REPAIR TABLE t1; ...@@ -252,3 +252,11 @@ REPAIR TABLE t1;
select count(*) from t1; select count(*) from t1;
drop table t1; drop table t1;
#
# testing out of bounds memory access in ft_nlq_find_relevance()
# (bug#8522); visible in valgrind.
#
CREATE TABLE t1 ( a TEXT, FULLTEXT (a) );
INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance');
SELECT MATCH(a) AGAINST ('nosuchword') FROM t1;
DROP TABLE t1;
...@@ -455,4 +455,3 @@ select min(a) is null from t1; ...@@ -455,4 +455,3 @@ select min(a) is null from t1;
select min(a) is null or null from t1; select min(a) is null or null from t1;
select 1 and min(a) is null from t1; select 1 and min(a) is null from t1;
drop table t1; drop table t1;
...@@ -424,7 +424,7 @@ innobase_mysql_tmpfile(void) ...@@ -424,7 +424,7 @@ innobase_mysql_tmpfile(void)
{ {
char filename[FN_REFLEN]; char filename[FN_REFLEN];
int fd2 = -1; int fd2 = -1;
File fd = create_temp_file(filename, NullS, "ib", File fd = create_temp_file(filename, mysql_tmpdir, "ib",
#ifdef __WIN__ #ifdef __WIN__
O_BINARY | O_TRUNC | O_SEQUENTIAL | O_BINARY | O_TRUNC | O_SEQUENTIAL |
O_TEMPORARY | O_SHORT_LIVED | O_TEMPORARY | O_SHORT_LIVED |
......
...@@ -111,6 +111,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, ...@@ -111,6 +111,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
bzero((char*) &tables,sizeof(tables)); bzero((char*) &tables,sizeof(tables));
tables.table = table; tables.table = table;
tables.alias = table_list->alias;
table->io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE), table->io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL)); MYF(MY_FAE | MY_ZEROFILL));
......
...@@ -504,8 +504,6 @@ check_connections(THD *thd) ...@@ -504,8 +504,6 @@ check_connections(THD *thd)
DBUG_PRINT("info",("New connection received on %s", DBUG_PRINT("info",("New connection received on %s",
vio_description(net->vio))); vio_description(net->vio)));
vio_in_addr(net->vio,&thd->remote.sin_addr);
if (!thd->host) // If TCP/IP connection if (!thd->host) // If TCP/IP connection
{ {
char ip[30]; char ip[30];
...@@ -515,6 +513,7 @@ check_connections(THD *thd) ...@@ -515,6 +513,7 @@ check_connections(THD *thd)
if (!(thd->ip = my_strdup(ip,MYF(0)))) if (!(thd->ip = my_strdup(ip,MYF(0))))
return (ER_OUT_OF_RESOURCES); return (ER_OUT_OF_RESOURCES);
thd->host_or_ip=thd->ip; thd->host_or_ip=thd->ip;
vio_in_addr(net->vio, &thd->remote.sin_addr);
#if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread) #if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread)
/* Fast local hostname resolve for Win32 */ /* Fast local hostname resolve for Win32 */
if (!strcmp(thd->ip,"127.0.0.1")) if (!strcmp(thd->ip,"127.0.0.1"))
...@@ -524,17 +523,19 @@ check_connections(THD *thd) ...@@ -524,17 +523,19 @@ check_connections(THD *thd)
} }
else else
#endif #endif
if (!(specialflag & SPECIAL_NO_RESOLVE))
{ {
thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors); if (!(specialflag & SPECIAL_NO_RESOLVE))
/* Cut very long hostnames to avoid possible overflows */
if (thd->host)
{ {
thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0; thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors);
thd->host_or_ip= thd->host; /* Cut very long hostnames to avoid possible overflows */
if (thd->host)
{
thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0;
thd->host_or_ip= thd->host;
}
if (connect_errors > max_connect_errors)
return(ER_HOST_IS_BLOCKED);
} }
if (connect_errors > max_connect_errors)
return(ER_HOST_IS_BLOCKED);
} }
DBUG_PRINT("info",("Host: %s ip: %s", DBUG_PRINT("info",("Host: %s ip: %s",
thd->host ? thd->host : "unknown host", thd->host ? thd->host : "unknown host",
...@@ -547,6 +548,8 @@ check_connections(THD *thd) ...@@ -547,6 +548,8 @@ check_connections(THD *thd)
DBUG_PRINT("info",("Host: %s",thd->host)); DBUG_PRINT("info",("Host: %s",thd->host));
thd->host_or_ip= thd->host; thd->host_or_ip= thd->host;
thd->ip= 0; thd->ip= 0;
/* Reset sin_addr */
bzero((char*) &thd->remote, sizeof(thd->remote));
} }
vio_keepalive(net->vio, TRUE); vio_keepalive(net->vio, TRUE);
......
...@@ -473,7 +473,10 @@ int mysql_multi_update_lock(THD *thd, ...@@ -473,7 +473,10 @@ int mysql_multi_update_lock(THD *thd,
else else
{ {
DBUG_PRINT("info",("setting table `%s` for read-only", tl->alias)); DBUG_PRINT("info",("setting table `%s` for read-only", tl->alias));
tl->lock_type= TL_READ; // If we are using the binary log, we need TL_READ_NO_INSERT to get
// correct order of statements. Otherwise, we use a TL_READ lock to
// improve performance.
tl->lock_type= using_update_log ? TL_READ_NO_INSERT : TL_READ;
tl->updating= 0; tl->updating= 0;
wants= SELECT_ACL; wants= SELECT_ACL;
} }
......
...@@ -822,7 +822,7 @@ create_select: ...@@ -822,7 +822,7 @@ create_select:
SELECT_SYM SELECT_SYM
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ; lex->lock_option= using_update_log ? TL_READ_NO_INSERT : TL_READ;
if (lex->sql_command == SQLCOM_INSERT) if (lex->sql_command == SQLCOM_INSERT)
lex->sql_command= SQLCOM_INSERT_SELECT; lex->sql_command= SQLCOM_INSERT_SELECT;
else if (lex->sql_command == SQLCOM_REPLACE) else if (lex->sql_command == SQLCOM_REPLACE)
...@@ -1532,7 +1532,7 @@ select_part2: ...@@ -1532,7 +1532,7 @@ select_part2:
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->lock_option=TL_READ; lex->lock_option=TL_READ;
mysql_init_select(lex); mysql_init_select(lex);
} }
select_options select_item_list select_into select_lock_type; select_options select_item_list select_into select_lock_type;
......
...@@ -291,6 +291,18 @@ my_bool vio_peer_addr(Vio * vio, char *buf, uint16 *port) ...@@ -291,6 +291,18 @@ my_bool vio_peer_addr(Vio * vio, char *buf, uint16 *port)
} }
/*
Get in_addr for a TCP/IP connection
SYNOPSIS
vio_in_addr()
vio vio handle
in put in_addr here
NOTES
one must call vio_peer_addr() before calling this one
*/
void vio_in_addr(Vio *vio, struct in_addr *in) void vio_in_addr(Vio *vio, struct in_addr *in)
{ {
DBUG_ENTER("vio_in_addr"); DBUG_ENTER("vio_in_addr");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment