mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 05:52:27 +01:00
2d43d0675e
- Add a check that length of field to uncompress is longer than 4 bytes. This can be dones as the length of uncompressed data is written as first four bytes of field and thus it can't be valid compressed data.
109 lines
4.2 KiB
Text
109 lines
4.2 KiB
Text
select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
|
|
@test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa '
|
|
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
select length(@test_compress_string);
|
|
length(@test_compress_string)
|
|
117
|
|
select uncompress(compress(@test_compress_string));
|
|
uncompress(compress(@test_compress_string))
|
|
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
explain extended select uncompress(compress(@test_compress_string));
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
|
Warnings:
|
|
Note 1003 select uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
|
|
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
|
|
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
|
|
1
|
|
explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
|
Warnings:
|
|
Note 1003 select (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
|
|
select uncompressed_length(compress(@test_compress_string));
|
|
uncompressed_length(compress(@test_compress_string))
|
|
117
|
|
select length(compress(@test_compress_string))<length(@test_compress_string);
|
|
length(compress(@test_compress_string))<length(@test_compress_string)
|
|
1
|
|
create table t1 (a text, b char(255), c char(4)) engine=myisam;
|
|
insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
|
|
select uncompress(a) from t1;
|
|
uncompress(a)
|
|
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
select uncompress(b) from t1;
|
|
uncompress(b)
|
|
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|
select concat('|',c,'|') from t1;
|
|
concat('|',c,'|')
|
|
|d|
|
|
drop table t1;
|
|
select compress("");
|
|
compress("")
|
|
|
|
select uncompress("");
|
|
uncompress("")
|
|
|
|
select uncompress(compress(""));
|
|
uncompress(compress(""))
|
|
|
|
select uncompressed_length("");
|
|
uncompressed_length("")
|
|
0
|
|
create table t1 (a text);
|
|
insert t1 values (compress(null)), ('A\0\0\0BBBBBBBB'), (compress(space(50000))), (space(50000));
|
|
select length(a) from t1;
|
|
length(a)
|
|
NULL
|
|
12
|
|
76
|
|
50000
|
|
select length(uncompress(a)) from t1;
|
|
length(uncompress(a))
|
|
NULL
|
|
NULL
|
|
50000
|
|
NULL
|
|
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 compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
|
|
compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
|
|
0
|
|
create table t1(a blob);
|
|
insert into t1 values(NULL), (compress('a'));
|
|
select uncompress(a), uncompressed_length(a) from t1;
|
|
uncompress(a) uncompressed_length(a)
|
|
NULL NULL
|
|
a 1
|
|
drop table t1;
|
|
create table t1 (a varchar(32) not null);
|
|
insert into t1 values ('foo');
|
|
explain select * from t1 where uncompress(a) is null;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 system NULL NULL NULL NULL 1
|
|
Warnings:
|
|
Error 1259 ZLIB: Input data corrupted
|
|
select * from t1 where uncompress(a) is null;
|
|
a
|
|
foo
|
|
Warnings:
|
|
Error 1259 ZLIB: Input data corrupted
|
|
explain select *, uncompress(a) from t1;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 system NULL NULL NULL NULL 1
|
|
select *, uncompress(a) from t1;
|
|
a uncompress(a)
|
|
foo NULL
|
|
Warnings:
|
|
Error 1259 ZLIB: Input data corrupted
|
|
select *, uncompress(a), uncompress(a) is null from t1;
|
|
a uncompress(a) uncompress(a) is null
|
|
foo NULL 1
|
|
Warnings:
|
|
Error 1259 ZLIB: Input data corrupted
|
|
Error 1259 ZLIB: Input data corrupted
|
|
drop table t1;
|
|
End of 5.0 tests
|