Commit graph

247 commits

Author SHA1 Message Date
Alexey Kopytov
bdcce95f13 Manual merge. 2009-06-01 16:00:38 +04:00
Alexey Kopytov
2df531fdc4 Bug #44767: invalid memory reads in password() and
old_password() functions   
The PASSWORD() and OLD_PASSWORD() functions could lead to   
memory reads outside of an internal buffer when used with BLOB   
arguments.   
  
String::c_ptr() assumes there is at least one extra byte  
in the internally allocated buffer when adding the trailing  
'\0'.  This, however, may not be the case when a String object  
was initialized with externally allocated buffer.  
  
The bug was fixed by adding an additional "length" argument to  
make_scrambled_password_323() and make_scrambled_password() in  
order to avoid String::c_ptr() calls for  
PASSWORD()/OLD_PASSWORD().  
  
However, since the make_scrambled_password[_323] functions are  
a part of the client library ABI, the functions with the new  
interfaces were implemented with the 'my_' prefix in their  
names, with the old functions changed to be wrappers around  
the new ones to maintain interface compatibility.
2009-05-27 14:20:57 +04:00
Georgi Kodinov
4cd9f6e1ae merged bug 35087 to 5.1-bugteam 2009-04-17 19:18:00 +03:00
Georgi Kodinov
4783b2e196 Bug #35087: Inserting duplicate values at one time with DES_ENCRYPT leads
to wrong results
      
3 problems found with DES_ENCRYPT/DES_DECRYPT :

1. The max length was not calculated properly. Fixed in fix_length_and_dec()
2. DES_ENCRYPT had a side effect of sometimes reallocating and changing 
the value of its argument. Fixed by explicitly pre-allocating the necessary
space to pad the argument with trailing '*' (stars) when calculating the 
DES digest.
3. in DES_ENCRYPT the string buffer for the result value was not 
reallocated to the correct size and only string length was assigned to it. 
Fixed by making sure there's enough space to hold the result.
2009-04-17 18:52:57 +03: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
Sergey Glukhov
0661c210d3 bug#35558 Wrong server metadata blows up the client
the problem: FORMAT func max_length value was calculated incorrectly
the fix: correct calculation of max_length
2008-12-09 14:00:43 +04:00
anozdrin/alik@quad.
340906f46d Fix for Bug#30217: Views: changes in metadata behaviour
between 5.0 and 5.1.
  
The problem was that in the patch for Bug#11986 it was decided
to store original query in UTF8 encoding for the INFORMATION_SCHEMA.
This approach however turned out to be quite difficult to implement
properly. The main problem is to preserve the same IS-output after
dump/restore.
  
So, the fix is to rollback to the previous functionality, but also
to fix it to support multi-character-set-queries properly. The idea
is to generate INFORMATION_SCHEMA-query from the item-tree after
parsing view declaration. The IS-query should:
  - be completely in UTF8;
  - not contain character set introducers.
  
For more information, see WL4052.
2008-02-22 13:30:33 +03:00
tsmith@ramayana.hindu.god
8fc0bfb6b6 Merge ramayana.hindu.god:/home/tsmith/m/bk/51
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/51-merge
2007-12-05 12:33:36 -07:00
cmiller@zippy.cornsilk.net
14394109fa Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-maint
2007-11-16 17:24:33 -05:00
holyfoot/hf@hfmain.(none)
439a50a1f0 Merge mysql.com:/home/hf/work/31758/my50-31758
into  mysql.com:/home/hf/work/31758/my51-31758
2007-11-05 18:27:17 +04:00
holyfoot/hf@hfmain.(none)
9f40b1dae3 Merge mysql.com:/home/hf/work/31758/my41-31758
into  mysql.com:/home/hf/work/31758/my50-31758
2007-11-05 18:12:42 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
e93574e9d1 Bug #31758 inet_ntoa, oct crashes server with null+filesort
Item_func_inet_ntoa and Item_func_conv inherit 'maybe_null' flag from an
argument, which is wrong.
Both can be NULL with notnull arguments, so that's fixed.
2007-10-30 12:35:03 +04:00
ramil/ram@ramil.myoffice.izhnet.ru
c7528dff69 Merge mysql.com:/home/ram/work/b31349/b31349.5.0
into  mysql.com:/home/ram/work/b31349/b31349.5.1
2007-10-23 13:55:06 +05:00
kaa@polly.(none)
d55d309380 Merge polly.(none):/home/kaa/src/opt/bug28550/my50-bug28550
into  polly.(none):/home/kaa/src/opt/bug28550/my51-bug28550
2007-10-21 21:49:30 +04:00
kaa@polly.(none)
349841118f Bug #28550 "Potential bugs related to the return type of the CHAR function".
Since, as of MySQL 5.0.15, CHAR() arguments larger than 255 are converted into multiple result bytes, a single CHAR() argument can now take up to 4 bytes. This patch fixes Item_func_char::fix_length_and_dec() to take this into account.
  
This patch also fixes a regression introduced by the patch for bug21513. As now we do not always have the 'name' member of Item set for Item_hex_string and Item_bin_string, an own print() method has been added to Item_hex_string so that it could correctly be printed by Item_func::print_args().
2007-10-21 21:45:31 +04:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
b4f558419f Fix for bug #31349: ERROR 1062 (23000): Duplicate entry '' for key 'group_key'
Problem: lying to the optimizer that a function (Item_func_inet_ntoa)
cannot return NULL values leads to unexpected results (in the case group
keys creation/comparison is broken). 

Fix: Item_func_inet_ntoa::maybe_null should be set properly.
2007-10-19 14:54:05 +05:00
gluh@eagle.(none)
16a0ecdb2b Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-10-11 16:13:14 +05:00
gluh@mysql.com/eagle.(none)
db39976a06 Bug#30981 CHAR(0x41 USING ucs2) doesn't add leading zero
Bug#30982 CHAR(..USING..) can return a not-well-formed string
Bug#30986 Character set introducer followed by a HEX string can return bad result
check_well_formed_result moved to Item from Item_str_func
fixed Item_func_char::val_str for proper ucs symbols converting
added check for well formed strings for correct conversion of constants with underscore
charset
2007-10-11 16:07:10 +05:00
monty@narttu.mysql.fi
9d609a59fd Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/my/mysql-5.1
2007-08-14 00:22:34 +03:00
monty@mysql.com/nosik.monty.fi
e53a73e26c Fixed a lot of compiler warnings and errors detected by Forte C++ on Solaris
Faster thr_alarm()
Added 'Opened_files' status variable to track calls to my_open()
Don't give warnings when running mysql_install_db
Added option --source-install to mysql_install_db

I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems
index_read()      -> index_read_map()
index_read_idx()  -> index_read_idx_map()
index_read_last() -> index_read_last_map()
2007-08-13 16:11:25 +03:00
holyfoot/hf@hfmain.(none)
37dece087e Merge mysql.com:/home/hf/work/29878/my50-29878
into  mysql.com:/home/hf/work/29878/my51-29878
2007-07-27 22:43:33 +05:00
holyfoot/hf@mysql.com/hfmain.(none)
03dfd986d7 Bug #29878 Garbage data generation when executing SESSION_USER() on a slave.
Item_func_user doesn't calculate anything in it's val_str() method,
just returns saved str_value.
Though Item::save_in_field method can destroy str_value, relying on
val_str() return. As a result we get the garbage stored in field.

We cannot use Item::save_in_field implementation for Item_func_user,
reimplement it in simpler way.
2007-07-27 18:42:25 +05:00
mikael@dator6.(none)
920a8ed5b3 Merge dator6.(none):/home/mikael/mysql_clones/clean-mysql-5.1
into  dator6.(none):/home/mikael/mysql_clones/bug18198
2007-06-13 16:03:18 +02:00
monty@mysql.com/narttu.mysql.fi
088e2395f1 WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:

- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t

Removed declaration of byte, gptr, my_string, my_size_t and size_s. 

Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
  instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
  as this requires fewer casts in the code and is more in line with how the
  standard functions work.
- Added extra length argument to dirname_part() to return the length of the
  created string.
- Changed (at least) following functions to take uchar* as argument:
  - db_dump()
  - my_net_write()
  - net_write_command()
  - net_store_data()
  - DBUG_DUMP()
  - decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
  argument to my_uncompress() from a pointer to a value as we only return
  one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
  the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
  casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.

Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
  needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
  explicitely as this conflict was often hided by casting the function to
  hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
  get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
  size_t. This was needed to properly detect errors (which are
  returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
  (portability fix)
- Removed windows specific code to restore cursor position as this
  causes slowdown on windows and we should not mix read() and pread()
  calls anyway as this is not thread safe. Updated function comment to
  reflect this. Changed function that depended on original behavior of
  my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
  m_size is the number of elements in the array, not a string/memory
  length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
  Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
  - Replaced some calls to alloc_root + memcpy to use
    strmake_root()/strdup_root().
  - Changed some calls from memdup() to strmake() (Safety fix)
  - Simpler loops in client-simple.c
2007-05-10 12:59:39 +03:00
evgen@moonbone.local
4434ff13a9 Merge moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.1-opt
2007-04-21 00:33:56 +04:00
gkodinov/kgeorge@magare.gmz
4202454baa Bug #27530:
The function CRC32() returns unsigned integer.
But the metadata (the unsigned flag) for the 
function was set incorrectly.
As a result type arithmetics based on the 
function's metadata (like finding the concise
type of an temporary table column to hold the result)
returned incorrect results.
Fixed by returning correct type information.

This fix is based on code contributed by Martin Friebe
(martin@hybyte.com) on 2007-03-30.
2007-04-11 13:58:16 +03:00
mikron@mikael-ronstr-ms-dator.local
3662119dcf Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-5.1
into  mikael-ronstr-ms-dator.local:/Users/mikron/mysql_clones/bug18198
2007-04-04 16:50:14 +02:00
mikron@mikael-ronstr-ms-dator.local
8161ab0b53 Reapplied patch for bug18198 2007-04-04 16:26:32 +02:00
gluh@mysql.com/eagle.(none)
2d47f0cb1b Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte 2007-04-03 16:13:27 +05:00
holyfoot/hf@hfmain.(none)
75be7cd1ae Merge mysql.com:/home/hf/work/mrg/mysql-5.0-opt
into  mysql.com:/home/hf/work/mrg/mysql-5.1-opt
2007-03-08 19:08:28 +04:00
gkodinov/kgeorge@magare.gmz
4a6efcd664 Bug #26537: item_unhex() was not expected
to return NULL for non-NULL arguments.
This is not the case as it can return NULL
for invalid hexidecimal strings.
Fixed by setting the maybe_null flag.
2007-03-02 12:14:50 +02:00
evgen@moonbone.local
8bb16e1e9c Merge moonbone.local:/work/latest-4.1-opt-mysql
into  moonbone.local:/work/latest-5.0-opt-mysql
2007-01-12 16:43:52 +03:00
evgen@moonbone.local
fc0e206cb5 Bug#23409: Arguments of the ENCODE() and the DECODE() functions were not printed
correctly.

The Item_func::print method was used to print the Item_func_encode and the
Item_func_decode objects. The last argument to ENCODE and DECODE functions
is a plain C string and thus Item_func::print wasn't able to print it.

The print() method is added to the Item_func_encode class. It correctly
prints the Item_func_encode and the Item_func_decode objects.
2007-01-11 16:45:38 +03:00
kent@kent-amd64.(none)
be15e3bc15 Merge mysql.com:/home/kent/bk/main/mysql-5.0
into  mysql.com:/home/kent/bk/main/mysql-5.1
2006-12-23 20:20:40 +01:00
kent@mysql.com/kent-amd64.(none)
226a5c833f Many files:
Changed header to GPL version 2 only
2006-12-23 20:17:15 +01:00
malff/marcsql@weblab.(none)
e8d51e62bb Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-22684
2006-11-16 10:06:36 -07:00
malff/marcsql@weblab.(none)
ccfbd68615 Bug#22684 (BENCHMARK, ENCODE, DECODE and FORMAT are not real functions)
Before this change, the functions BENCHMARK, ENCODE, DECODE and FORMAT could
only accept a constant for some parameters.

After this change, this restriction has been removed. An implication is that
these functions can also be used in prepared statements.

The change consist of changing the following classes:
- Item_func_benchmark
- Item_func_encode
- Item_func_decode
- Item_func_format
to:
- only accept Item* in the constructor,
- and evaluate arguments during calls to val_xxx()
which fits the general design of all the other functions.

The 'TODO' items identified in item_create.cc during the work done for
Bug 21114 are addressed by this fix, as a natural consequence of aligning
the design.

In the 'func_str' test, a single very long test line involving an explain
extended select with many functions has been rewritten into multiple
separate tests, to improve maintainability.
The result of explain extended select decode(encode(...)) has changed,
since the encode and decode functions now print all their parameters.
2006-11-16 09:03:47 -07:00
kroki/tomash@moonlight.intranet
0f94e84fd2 Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug17047
into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.1-bug17047
2006-11-16 14:13:03 +03:00
kroki/tomash@moonlight.intranet
9e7f682116 Add 5.0 part of fix for bug 17047. 2006-11-16 14:06:51 +03:00
mikael/pappa@dator5.(none)
58ee682e9d BUG#18198
Review comments
2006-09-26 02:25:23 -04:00
mikael/pappa@dator5.(none)
de9001d3c4 Merge dator5.(none):/home/pappa/clean-mysql-5.1
into  dator5.(none):/home/pappa/bug18198
2006-09-26 01:49:14 -04:00
msvensson@shellback.(none)
8de35293af Merge shellback.(none):/home/msvensson/mysql/mysql-5.1
into  shellback.(none):/home/msvensson/mysql/mysql-5.1-new-maint
2006-09-01 11:23:08 +02:00
msvensson@shellback.(none)
d463972da7 Merge shellback.(none):/home/msvensson/mysql/mysql-5.0
into  shellback.(none):/home/msvensson/mysql/mysql-5.0-maint
2006-08-31 11:57:36 +02:00
kostja@bodhi.local
ebb7070430 Merge bodhi.local:/opt/local/work/mysql-5.0-runtime-safemerge
into  bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
2006-08-30 03:00:19 +04:00
kostja@bodhi.local
f8d34e1030 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-14897
2006-08-30 00:45:33 +04:00
mikael/pappa@dator5.(none)
3b9f4a616c Merge dator5.(none):/home/pappa/clean-mysql-5.1
into  dator5.(none):/home/pappa/bug18198
2006-08-26 06:18:41 -04:00
kroki/tomash@moonlight.intranet
b6bee0a394 BUG#21166: Prepared statement causes signal 11 on second execution
Changes in an item tree done by optimizer weren't properly
registered and went unnoticed, which resulted in preliminary freeing
of used memory.
2006-08-24 15:49:12 +04:00
tsmith/tim@siva.hindu.god
b8521714af Merge siva.hindu.god:/usr/home/tim/m/bk/b20536-41
into  siva.hindu.god:/usr/home/tim/m/bk/41
2006-08-23 16:30:05 -06:00
tsmith/tim@siva.hindu.god
bf8fc6e82a Merge siva.hindu.god:/usr/home/tim/m/bk/b20536-50
into  siva.hindu.god:/usr/home/tim/m/bk/50
2006-08-23 13:43:28 -06:00
tsmith/tim@siva.hindu.god
ecc1e1fe7d Merge siva.hindu.god:/usr/home/tim/m/bk/b20536-51
into  siva.hindu.god:/usr/home/tim/m/bk/51
2006-08-23 13:28:01 -06:00