Commit graph

822 commits

Author SHA1 Message Date
Davi Arnaut
0d7c321540 Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run
Fix a regression (due to a typo) which caused spurious incorrect
argument errors for long data stream parameters if all forms of
logging were disabled (binary, general and slow logs).
2010-07-30 09:17:10 -03:00
Davi Arnaut
ed9ffc6b09 Bug#45288: pb2 returns a lot of compilation warnings on linux
Although the C standard mandates that sprintf return the number
of bytes written, some very ancient systems (i.e. SunOS 4)
returned a pointer to the buffer instead. Since these systems
are not supported anymore and are hopefully long dead by now,
simply remove the portability wrapper that dealt with this
discrepancy. The autoconf check was causing trouble with GCC.
2010-07-09 09:00:17 -03:00
Davi Arnaut
93fb8bb235 Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.

One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.

There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.
2010-07-02 15:30:47 -03:00
Davi Arnaut
aa1dddd5ca Merge of mysql-5.0-bugteam into mysql-5.1-bugteam. 2010-06-28 17:29:19 -03:00
Davi Arnaut
07767edcce Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run
The problem was that a user could supply supply data in chunks
via the COM_STMT_SEND_LONG_DATA command to prepared statement
parameter other than of type TEXT or BLOB. This posed a problem
since other parameter types aren't setup to handle long data,
which would lead to a crash when attempting to use the supplied
data.

Given that long data can be supplied at any stage of a prepared
statement, coupled with the fact that the type of a parameter
marker might change between consecutive executions, the solution
is to validate at execution time each parameter marker for which
a data stream was provided. If the parameter type is not TEXT or
BLOB (that is, if the type is not able to handle a data stream),
a error is returned.
2010-06-28 12:21:28 -03:00
Davi Arnaut
bb036c93b4 Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations.

Essentially, the problem is that large parts of the server were
developed in simpler times (last decades, pre C99 standard) when
strict aliasing and compilers supporting such optimizations were
rare to non-existent. Thus, when compiling the server with a modern
compiler that uses strict aliasing rules to perform optimizations,
there are several places in the code that might trigger undefined
behavior.

As evinced by some recent bugs, GCC does a somewhat good of job
misoptimizing such code, but on the other hand also gives warnings
about suspicious code. One problem is that the warnings aren't
always accurate, yet we can't afford to just shut them off as we
might miss real cases. False-positive cases are aggravated mostly
by casts that are likely to trigger undefined behavior.

The solution is to start a cleanup process focused on fixing and
reducing the amount of strict-aliasing related warnings produced
by GCC and others compilers. A good deal of noise reduction can
be achieved by just removing useless casts that are product of
historical cruft and are likely to trigger undefined behavior if
dereferenced.
2010-06-10 17:16:43 -03:00
Ramil Kalimullin
442e0f01f2 Manual merge. 2010-05-25 22:30:08 +04:00
Ramil Kalimullin
edfea7d590 Fix for bug #53907: Table dump command can be abused to dump arbitrary tables.
Problem: one with SELECT privilege on some table may dump other table
performing COM_TABLE_DUMP command due to missed check of the table name.

Fix: check the table name.
2010-05-25 17:56:23 +04:00
Jim Winstead
bea068326f Using an initial command with mysql_options(..., MYSQL_INIT_COMMAND, ...)
that generated multiple result sets (such as a stored procedure or a
multi-statement command) would leave the connection unusable. (Bug #42373)

A side-effect of this bug fix is to make MYSQL_INIT_COMMAND settings ignored
when connecting from within the server, but none of the existing mechanisms
for connecting from within the server use or need to set the initial command.
2010-05-09 20:02:05 -07:00
Georgi Kodinov
0f26a0533b Bug #53371: COM_FIELD_LIST can be abused to bypass table level grants.
This is the 5.1 merge and extension of the fix.
The server was happily accepting paths in table name in all places a table
name is accepted (e.g. a SELECT). This allowed all users that have some 
privilege over some database to read all tables in all databases in all
mysql server instances that the server file system has access to.
Fixed by :
1. making sure no path elements are allowed in quoted table name when
constructing the path (note that the path symbols are still valid in table names
when they're properly escaped by the server).
2. checking the #mysql50# prefixed names the same way they're checked for
path elements in mysql-5.0.
2010-05-04 17:03:28 +03:00
Georgi Kodinov
6ae9c70109 Bug #53371: COM_FIELD_LIST can be abused to bypass table level grants.
The server was not checking the supplied to COM_FIELD_LIST table name
for validity and compliance to acceptable table names standards.
Fixed by checking the table name for compliance similar to how it's 
normally checked by the parser and returning an error message if 
it's not compliant.
2010-05-03 18:16:51 +03:00
Vladislav Vaintroub
2f075a1e37 Bug #47423 mtr connects to wrong database
The reason for the bug is that mysqtest as well as other client tools
running in test suite (mysqlbinlog, mysqldump) will first try to connect 
whatever database has created shared memory with default base name 
"MySQL" and use this. (Same effect could be seen on Unix if mtr would
not care to calculate "port" and "socket" parameter).
      
The fix ensures that all client tools and  running in mtr use unique  
per-database shared memory base parameters, so there is no possibility
to clash with already installed one. We use socket name for shared memory 
base (it's known to be unique). This shared-memory-base is written to the
MTR config file to the [client] and [mysqld] sections. Fix made also made 
sure all client tools understand and correctly handle --shared-memory-base.
Prior to this patch  it was not the case for  mysqltest, mysqlbinlog and 
mysql_client_test.
      
All new connections done from mtr scripts via connect() will by default 
set shared-memory-base. And finally, there is a possibility to force 
shared memory or pipe connection and overwrite shared memory/pipe base name
from within mtr scripts via optional PIPE or SHM modifier. This functionality
was manually backported from 6.0
(original patch  http://lists.mysql.com/commits/74749)
2009-11-03 01:19:37 +01:00
Georgi Kodinov
f7fa5d5a02 fixed compilation warnings 2009-09-02 13:09:01 +03:00
Davi Arnaut
a0e44ec1e8 Fix for a few assorted compiler warnings. 2009-08-28 12:06:59 -03:00
Davi Arnaut
69fbbdc19d Bug#45010: invalid memory reads during parsing some strange statements
The problem is that the lexer could inadvertently skip over the
end of a query being parsed if it encountered a malformed multibyte
character. A specially crated query string could cause the lexer
to jump up to six bytes past the end of the query buffer. Another
problem was that the laxer could use unfiltered user input as
a signed array index for the parser maps (having upper and lower
bounds 0 and 256 respectively).

The solution is to ensure that the lexer only skips over well-formed
multibyte characters and that the index value of the parser maps
is always a unsigned value.
2009-08-07 23:32:01 -03:00
Davi Arnaut
77acccc21f Merge from mysql-5.0. 2009-08-04 10:47:18 -03:00
Davi Arnaut
93bd65b04b Bug#20023: mysql_change_user() resets the value of SQL_BIG_SELECTS
Post-merge fix: test case could fail due to a conversion of the
max_join_size value to a integer. Fixed by preserving the value
as a string for comparison purposes.
2009-07-27 12:31:28 -03:00
Joerg Bruehe
67ffeccf2c Merge main 5.0 into 5.0-build. 2009-07-09 23:10:50 +02:00
Davi Arnaut
eb94a70784 Manual merge. 2009-08-10 15:46:20 -03:00
Davi Arnaut
c13b8fca5f Merge from mysql-5.1. 2009-08-04 10:50:20 -03:00
Davi Arnaut
4fe66512fa Merge from mysql-5.0-bugteam. 2009-07-27 15:24:43 -03:00
Joerg Bruehe
c4381e9810 Merge main 5.1 into 5.1-build. 2009-07-16 09:13:19 +02:00
Davi Arnaut
0830a3bef3 Bug#44495: Prepared Statement: CALL p(<x>) - `thd->protocol == &thd->protocol_text' failed
Merge Konstantin's patch and add a test case.
2009-07-15 15:22:50 -03:00
Staale Smedseng
f46dba5a5f Bug #43397 mysql headers redefine pthread_mutex_init
unnecessarily
      
The problem is that libmysqlclient.so is built with THREAD
undefined, while a client compiling against the same header
files will see THREAD as defined and definitions in
my_pthread.h will be included, possibly resulting in undefined
symbols that cannot be resolved with libmysqlclient.so.
      
The suggested solution is to require that clients wanting to
link with libmysqlclient.so should be built with
MYSQL_CLIENT_NO_THREADS defined. This requires a documentation
change, and more details for this will be supplied if this
patch is approved.
      
The MYSQL_CLIENT_NO_THREADS define was renamed from
UNDEF_THREADS_HACK, to get a more suitable (less suspicious)
name for the define. (The UNDEF_THREADS_HACK is retained for
backwards compatibility, though.)
      
This patch is also in anticipation of WL#4958, which will
remove this problem altogether by dropping the building of
libmysqlclient.
2009-07-08 16:49:45 +02:00
Georgi Kodinov
bf6e255d8c Bug #45287: phase 2 : 5.0 64 bit compilation warnings
Fixed various compilation warnings when compiling on a 
 64 bit windows.
2009-07-16 15:37:38 +03:00
Ramil Kalimullin
381da0c9d8 Fix for bug#42364 reverted. 2009-07-06 11:55:53 +05:00
Daniel Fischer
6981425ad8 merge fix 2009-07-03 14:12:35 +02:00
Daniel Fischer
3e754876fc Bug#44647 - fix file permissions. 2009-07-03 13:48:08 +02:00
Sergey Glukhov
5072f4da36 Bug#42364 SHOW ERRORS returns empty resultset after dropping non existent table
enabled message storing into error message list
for 'drop table' command
2009-07-03 13:22:06 +05:00
Staale Smedseng
490f443221 Bug #45790 Potential DoS vector: Writing of user input to log
without proper formatting
      
The problem is that a suitably crafted database identifier
supplied to COM_CREATE_DB or COM_DROP_DB can cause a SIGSEGV,
and thereby a denial of service. The database name is printed
to the log without using a format string, so potential
attackers can control the behavior of my_b_vprintf() by
supplying their own format string. A CREATE or DROP privilege
would be required.
      
This patch supplies a format string to the printing of the
database name. A test case is added to mysql_client_test.
2009-07-01 14:09:44 +02:00
Davi Arnaut
d30375be39 Workaround a compiler that does not support certain C99 features for C code. 2009-05-23 10:19:58 -03:00
Staale Smedseng
57ba432293 Recommit of bug 43560 after merge with mysql-5.1-bugteam 2009-05-20 16:17:47 +02:00
Bernt M. Johnsen
9ae04e6d2e Bug#23471 prepared for commit in 5.1 gca branch 2009-05-05 12:34:25 +02:00
Bernt M. Johnsen
2fd7330c2e Bug#23471 prepared for commit in 5.0 gca branch 2009-05-05 11:07:11 +02:00
Alexey Botchkov
b1444f40d5 merging 2009-04-30 12:54:45 +05:00
Alexey Botchkov
d7ad0a04d1 mysql_client_test fixed.
per-file comments:
  tests/mysql_client_test.c
the test for bug 37956 isn't relevant anymore.
The query there 'select point(?,?)' doesn't produce an error.
2009-04-30 12:52:27 +05:00
Ignacio Galarza
e82390130e auto-merge 2009-03-19 09:44:58 -04:00
Ignacio Galarza
428e28e00c auto-merge 2009-03-17 16:29:24 -04:00
Kristofer Pettersson
d6634f461b Manual merge 2009-03-06 11:49:39 +01:00
Kristofer Pettersson
76a5891429 Bug#40363 Bug 20023 is not fixed on 5.0
This is a back port from 5.1 to 5.0.

Fix for BUG 20023: mysql_change_user() resets the value
of SQL_BIG_SELECTS.
  
The bug was that SQL_BIG_SELECTS was not properly set
in COM_CHANGE_USER.
  
The fix is to update SQL_BIG_SELECTS properly.
2009-03-05 13:37:46 +01:00
Ramil Kalimullin
3a29b7afaa Auto-merge 2009-02-26 16:14:33 +04:00
Ramil Kalimullin
c8e908ffcc Fix for bug#19829:make test Failed in mysql_client_test
*with --with-charset=utf8*

Problem: wrong LONG TEXT field length is sent to a client 
when multibyte server character set used.

Fix: always limit field length sent to a client to 2^32,
as we store it in 4 byte slot.

Note: mysql_client_test changed accordingly.
2009-02-26 12:34:15 +04:00
Alexey Kopytov
57b54ae7b1 Automerge. 2009-02-19 11:56:16 +03:00
Alexey Kopytov
c4f0c2d38c Fix for bug #41078: With CURSOR_TYPE_READ_ONLY mysql_stmt_fetch()
returns short string value. 
 
Multibyte character sets were not taken into account when 
calculating max_length in Item_param::convert_str_value(). As a 
result, string parameters of a prepared statement could be 
truncated later when calculating string length in characters by 
dividing length in bytes by the charset's mbmaxlen value (e.g. in 
Field_varstring::store()). 
 
Fixed by taking charset's mbmaxlen into account when calculating 
max_length in Item_param::convert_str_value().
2009-02-19 11:49:35 +03:00
Ignacio Galarza
2d9421c3bb Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-13 11:41:47 -05:00
Ignacio Galarza
2b85c64d65 Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-10 17:47:54 -05:00
Davi Arnaut
cf5dd72ee0 Merge from 5.0-bugteam 2009-01-15 08:28:10 -02:00
Davi Arnaut
918a038165 Bug#36326: nested transaction and select
The problem is that the query cache stores packets containing
the server status of the time when the cached statement was run.
This might lead to a wrong transaction status in the client side
if a statement is cached during a transaction and is later served
outside a transaction context (and vice-versa).

The solution is to take into account the transaction status when
storing in and serving from the query cache.
2009-01-13 20:07:06 -02:00
Sergey Glukhov
dfcefa2034 5.0-bugteam->5.1-bugteam merge 2008-12-11 14:49:56 +04:00
Sergey Glukhov
e419c5d349 fix for pushbuild failure on 64 linux 2008-12-11 14:37:18 +04:00