mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 05:52:27 +01:00
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into gw.mysql.r18.ru:/usr/home/ram/work/4.1.b5497
This commit is contained in:
commit
3997051d94
3 changed files with 20 additions and 3 deletions
|
@ -68,3 +68,7 @@ Warnings:
|
|||
Error 1259 ZLIB: Input data corrupted
|
||||
Error 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
|
||||
drop table t1;
|
||||
set @@max_allowed_packet=1048576*100;
|
||||
select length(compress(repeat('aaaaaaaaaa', 10000000)));
|
||||
length(compress(repeat('aaaaaaaaaa', 10000000)))
|
||||
97214
|
||||
|
|
|
@ -35,3 +35,10 @@ select length(a) from t1;
|
|||
select length(uncompress(a)) from t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug #5497: a problem with large strings
|
||||
#
|
||||
|
||||
set @@max_allowed_packet=1048576*100;
|
||||
select length(compress(repeat('aaaaaaaaaa', 10000000)));
|
||||
|
|
|
@ -2731,12 +2731,18 @@ String *Item_func_compress::val_str(String *str)
|
|||
compress(compress(compress(...)))
|
||||
I.e. zlib give number 'at least'..
|
||||
*/
|
||||
ulong new_size= (ulong)((res->length()*120)/100)+12;
|
||||
ulong new_size= res->length() + res->length() / 5 + 12;
|
||||
|
||||
// Will check new_size overflow: new_size <= res->length()
|
||||
if (((uint32) new_size <= res->length()) ||
|
||||
buffer.realloc((uint32) new_size + 4 + 1))
|
||||
{
|
||||
null_value= 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
buffer.realloc((uint32)new_size + 4 + 1);
|
||||
Byte *body= ((Byte*)buffer.ptr()) + 4;
|
||||
|
||||
|
||||
// As far as we have checked res->is_empty() we can use ptr()
|
||||
if ((err= compress(body, &new_size,
|
||||
(const Bytef*)res->ptr(), res->length())) != Z_OK)
|
||||
|
|
Loading…
Reference in a new issue