summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-05-21 20:05:21 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-05-21 20:05:21 +0000
commitc61a2f58418e9fa1d5d36a22351b7350b8ad1400 (patch)
tree85dc5ecf324951e2c6a67c9028193a3a8634acbe /src/test
parent1f219cf433e792d61040246c24b136b0e6a2c930 (diff)
downloadpostgresql-c61a2f58418e9fa1d5d36a22351b7350b8ad1400.tar.gz
Change the backend to reject strings containing invalidly-encoded multibyte
characters in all cases. Formerly we mostly just threw warnings for invalid input, and failed to detect it at all if no encoding conversion was required. The tighter check is needed to defend against SQL-injection attacks as per CVE-2006-2313 (further details will be published after release). Embedded zero (null) bytes will be rejected as well. The checks are applied during input to the backend (receipt from client or COPY IN), so it no longer seems necessary to check in textin() and related routines; any string arriving at those functions will already have been validated. Conversion failure reporting (for characters with no equivalent in the destination encoding) has been cleaned up and made consistent while at it. Also, fix a few longstanding errors in little-used encoding conversion routines: win1251_to_iso, win866_to_iso, euc_tw_to_big5, euc_tw_to_mic, mic_to_euc_tw were all broken to varying extents. Patches by Tatsuo Ishii and Tom Lane. Thanks to Akio Ishida and Yasuo Ohgaki for identifying the security issues.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/mb/expected/mule_internal.out314
1 files changed, 157 insertions, 157 deletions
diff --git a/src/test/mb/expected/mule_internal.out b/src/test/mb/expected/mule_internal.out
index fa1f836feb..ac8b57dc42 100644
--- a/src/test/mb/expected/mule_internal.out
+++ b/src/test/mb/expected/mule_internal.out
@@ -8,81 +8,81 @@ insert into גђ values('Ԓ咡钥ՒÒ','
insert into גђ values('Ԓ咡ג풥钥ޒ','Z01');
vacuum גђ;
select * from גђ;
- ђ | ʬ | 1a
------------------------------------------+-----------------+----------------
- Ԓ咡ǒג쒥 | A01 |
- Ԓ咡钥ՒÒ | ʬB10 |
- Ԓ咡ג풥钥ޒ | Z01 |
+ ђ | ʬ | 1a
+----------------------------+------------+------------
+ Ԓ咡ǒג쒥 | A01 |
+ Ԓ咡钥ՒÒ | ʬB10 |
+ Ԓ咡ג풥钥ޒ | Z01 |
(3 rows)
select * from גђ where ʬ = 'Z01';
- ђ | ʬ | 1a
---------------------------------------+-----------------+----------------
- Ԓ咡ג풥钥ޒ | Z01 |
+ ђ | ʬ | 1a
+--------------------------+------------+------------
+ Ԓ咡ג풥钥ޒ | Z01 |
(1 row)
select * from גђ where ʬ ~* 'z01';
- ђ | ʬ | 1a
---------------------------------------+-----------------+----------------
- Ԓ咡ג풥钥ޒ | Z01 |
+ ђ | ʬ | 1a
+--------------------------+------------+------------
+ Ԓ咡ג풥钥ޒ | Z01 |
(1 row)
select * from גђ where ʬ like '_Z01_';
- ђ | ʬ | 1a
---------------------------------------+-----------------+----------------
- Ԓ咡ג풥钥ޒ | Z01 |
+ ђ | ʬ | 1a
+--------------------------+------------+------------
+ Ԓ咡ג풥钥ޒ | Z01 |
(1 row)
select * from גђ where ʬ like '_Z%';
- ђ | ʬ | 1a
---------------------------------------+-----------------+----------------
- Ԓ咡ג풥钥ޒ | Z01 |
+ ђ | ʬ | 1a
+--------------------------+------------+------------
+ Ԓ咡ג풥钥ޒ | Z01 |
(1 row)
select * from גђ where ђ ~ 'Ԓ咡[ǒ]';
- ђ | ʬ | 1a
------------------------------------------+-----------------+----------------
- Ԓ咡ǒג쒥 | A01 |
- Ԓ咡钥ՒÒ | ʬB10 |
+ ђ | ʬ | 1a
+----------------------------+------------+------------
+ Ԓ咡ǒג쒥 | A01 |
+ Ԓ咡钥ՒÒ | ʬB10 |
(2 rows)
select * from גђ where ђ ~* 'Ԓ咡[ǒ]';
- ђ | ʬ | 1a
------------------------------------------+-----------------+----------------
- Ԓ咡ǒג쒥 | A01 |
- Ԓ咡钥ՒÒ | ʬB10 |
+ ђ | ʬ | 1a
+----------------------------+------------+------------
+ Ԓ咡ǒג쒥 | A01 |
+ Ԓ咡钥ՒÒ | ʬB10 |
(2 rows)
select *,character_length(ђ) from גђ;
- ђ | ʬ | 1a | character_length
------------------------------------------+-----------------+----------------+------------------
- Ԓ咡ǒג쒥 | A01 | | 12
- Ԓ咡钥ՒÒ | ʬB10 | | 13
- Ԓ咡ג풥钥ޒ | Z01 | | 12
+ ђ | ʬ | 1a | character_length
+----------------------------+------------+------------+------------------
+ Ԓ咡ǒג쒥 | A01 | | 12
+ Ԓ咡钥ՒÒ | ʬB10 | | 13
+ Ԓ咡ג풥钥ޒ | Z01 | | 12
(3 rows)
select *,octet_length(ђ) from גђ;
- ђ | ʬ | 1a | octet_length
------------------------------------------+-----------------+----------------+--------------
- Ԓ咡ǒג쒥 | A01 | | 36
- Ԓ咡钥ՒÒ | ʬB10 | | 39
- Ԓ咡ג풥钥ޒ | Z01 | | 36
+ ђ | ʬ | 1a | octet_length
+----------------------------+------------+------------+--------------
+ Ԓ咡ǒג쒥 | A01 | | 36
+ Ԓ咡钥ՒÒ | ʬB10 | | 39
+ Ԓ咡ג풥钥ޒ | Z01 | | 36
(3 rows)
select *,position('' in ђ) from גђ;
- ђ | ʬ | 1a | position
------------------------------------------+-----------------+----------------+----------
- Ԓ咡ǒג쒥 | A01 | | 7
- Ԓ咡钥ՒÒ | ʬB10 | | 0
- Ԓ咡ג풥钥ޒ | Z01 | | 0
+ ђ | ʬ | 1a | position
+----------------------------+------------+------------+----------
+ Ԓ咡ǒג쒥 | A01 | | 7
+ Ԓ咡钥ՒÒ | ʬB10 | | 0
+ Ԓ咡ג풥钥ޒ | Z01 | | 0
(3 rows)
select *,substring(ђ from 10 for 4) from גђ;
- ђ | ʬ | 1a | substring
------------------------------------------+-----------------+----------------+--------------
- Ԓ咡ǒג쒥 | A01 | | ג쒥
- Ԓ咡钥ՒÒ | ʬB10 | | Ò
- Ԓ咡ג풥钥ޒ | Z01 | | 钥ޒ
+ ђ | ʬ | 1a | substring
+----------------------------+------------+------------+-----------
+ Ԓ咡ǒג쒥 | A01 | | ג쒥
+ Ԓ咡钥ՒÒ | ʬB10 | | Ò
+ Ԓ咡ג풥钥ޒ | Z01 | | 钥ޒ
(3 rows)
drop table Ƒ㑻;
@@ -95,81 +95,81 @@ insert into Ƒ㑻 values('ԑͼ','B01');
insert into Ƒ㑻 values('ԑ̑Ա','Z01');
vacuum Ƒ㑻;
select * from Ƒ㑻;
- | ֑ | ע1a
------------------+-----------+----------
+ | ֑ | ע1a
+------------+---------+--------
ԑԑʾ | A01 |
- ԑͼ | B01 |
+ ԑͼ | B01 |
ԑ̑Ա | Z01 |
(3 rows)
select * from Ƒ㑻 where ֑ = 'Z01';
- | ֑ | ע1a
------------------+-----------+----------
+ | ֑ | ע1a
+------------+---------+--------
ԑ̑Ա | Z01 |
(1 row)
select * from Ƒ㑻 where ֑ ~* 'z01';
- | ֑ | ע1a
------------------+-----------+----------
+ | ֑ | ע1a
+------------+---------+--------
ԑ̑Ա | Z01 |
(1 row)
select * from Ƒ㑻 where ֑ like '_Z01_';
- | ֑ | ע1a
------------------+-----------+----------
+ | ֑ | ע1a
+------------+---------+--------
ԑ̑Ա | Z01 |
(1 row)
select * from Ƒ㑻 where ֑ like '_Z%';
- | ֑ | ע1a
------------------+-----------+----------
+ | ֑ | ע1a
+------------+---------+--------
ԑ̑Ա | Z01 |
(1 row)
select * from Ƒ㑻 where ~ '[ԑͼ]';
- | ֑ | ע1a
------------------+-----------+----------
+ | ֑ | ע1a
+------------+---------+--------
ԑԑʾ | A01 |
- ԑͼ | B01 |
+ ԑͼ | B01 |
(2 rows)
select * from Ƒ㑻 where ~* '[ԑͼ]';
- | ֑ | ע1a
------------------+-----------+----------
+ | ֑ | ע1a
+------------+---------+--------
ԑԑʾ | A01 |
- ԑͼ | B01 |
+ ԑͼ | B01 |
(2 rows)
select *,character_length() from Ƒ㑻;
- | ֑ | ע1a | character_length
------------------+-----------+----------+------------------
- ԑԑʾ | A01 | | 5
- ԑͼ | B01 | | 4
- ԑ̑Ա | Z01 | | 5
+ | ֑ | ע1a | character_length
+------------+---------+--------+------------------
+ ԑԑʾ | A01 | | 5
+ ԑͼ | B01 | | 4
+ ԑ̑Ա | Z01 | | 5
(3 rows)
select *,octet_length() from Ƒ㑻;
- | ֑ | ע1a | octet_length
------------------+-----------+----------+--------------
- ԑԑʾ | A01 | | 15
- ԑͼ | B01 | | 12
- ԑ̑Ա | Z01 | | 15
+ | ֑ | ע1a | octet_length
+------------+---------+--------+--------------
+ ԑԑʾ | A01 | | 15
+ ԑͼ | B01 | | 12
+ ԑ̑Ա | Z01 | | 15
(3 rows)
select *,position('' in ) from Ƒ㑻;
- | ֑ | ע1a | position
------------------+-----------+----------+----------
- ԑԑʾ | A01 | | 3
- ԑͼ | B01 | | 0
- ԑ̑Ա | Z01 | | 0
+ | ֑ | ע1a | position
+------------+---------+--------+----------
+ ԑԑʾ | A01 | | 3
+ ԑͼ | B01 | | 0
+ ԑ̑Ա | Z01 | | 0
(3 rows)
select *,substring( from 3 for 4) from Ƒ㑻;
- | ֑ | ע1a | substring
------------------+-----------+----------+-----------
- ԑԑʾ | A01 | | ԑʾ
- ԑͼ | B01 | | ͼ
- ԑ̑Ա | Z01 | | ̑Ա
+ | ֑ | ע1a | substring
+------------+---------+--------+-----------
+ ԑԑʾ | A01 | | ԑʾ
+ ԑͼ | B01 | | ͼ
+ ԑ̑Ա | Z01 | | ̑Ա
(3 rows)
drop table ͪߩѦ듾;
@@ -182,81 +182,81 @@ insert into ͪߩѦ듾 values('ēǻ͓דȓ', 'B10');
insert into ͪߩѦ듾 values('ēǻ͓Γד', 'Z01');
vacuum ͪߩѦ듾;
select * from ͪߩѦ듾;
- 듾 | “׾ړ | 1a󓱸
---------------------------+--------------+----------------
- ēǻ͓𓽺Ó | ѦA01߾ |
- ēǻ͓דȓ | B10 |
- ēǻ͓Γד | Z01 |
+ 듾 | “׾ړ | 1a󓱸
+------------------+----------+------------
+ ēǻ͓𓽺Ó | ѦA01߾ |
+ ēǻ͓דȓ | B10 |
+ ēǻ͓Γד | Z01 |
(3 rows)
select * from ͪߩѦ듾 where “׾ړ = 'Z01';
- 듾 | “׾ړ | 1a󓱸
---------------------------+--------------+----------------
- ēǻ͓Γד | Z01 |
+ 듾 | “׾ړ | 1a󓱸
+------------------+----------+------------
+ ēǻ͓Γד | Z01 |
(1 row)
select * from ͪߩѦ듾 where “׾ړ ~* 'z01';
- 듾 | “׾ړ | 1a󓱸
---------------------------+--------------+----------------
- ēǻ͓Γד | Z01 |
+ 듾 | “׾ړ | 1a󓱸
+------------------+----------+------------
+ ēǻ͓Γד | Z01 |
(1 row)
select * from ͪߩѦ듾 where “׾ړ like '_Z01_';
- 듾 | “׾ړ | 1a󓱸
---------------------------+--------------+----------------
- ēǻ͓Γד | Z01 |
+ 듾 | “׾ړ | 1a󓱸
+------------------+----------+------------
+ ēǻ͓Γד | Z01 |
(1 row)
select * from ͪߩѦ듾 where “׾ړ like '_Z%';
- 듾 | “׾ړ | 1a󓱸
---------------------------+--------------+----------------
- ēǻ͓Γד | Z01 |
+ 듾 | “׾ړ | 1a󓱸
+------------------+----------+------------
+ ēǻ͓Γד | Z01 |
(1 row)
select * from ͪߩѦ듾 where 듾 ~ 'ēǻ[]';
- 듾 | “׾ړ | 1a󓱸
---------------------------+--------------+----------------
- ēǻ͓𓽺Ó | ѦA01߾ |
- ēǻ͓דȓ | B10 |
+ 듾 | “׾ړ | 1a󓱸
+------------------+----------+------------
+ ēǻ͓𓽺Ó | ѦA01߾ |
+ ēǻ͓דȓ | B10 |
(2 rows)
select * from ͪߩѦ듾 where 듾 ~* 'ēǻ[]';
- 듾 | “׾ړ | 1a󓱸
---------------------------+--------------+----------------
- ēǻ͓𓽺Ó | ѦA01߾ |
- ēǻ͓דȓ | B10 |
+ 듾 | “׾ړ | 1a󓱸
+------------------+----------+------------
+ ēǻ͓𓽺Ó | ѦA01߾ |
+ ēǻ͓דȓ | B10 |
(2 rows)
select *,character_length(듾) from ͪߩѦ듾;
- 듾 | “׾ړ | 1a󓱸 | character_length
---------------------------+--------------+----------------+------------------
- ēǻ͓𓽺Ó | ѦA01߾ | | 8
- ēǻ͓דȓ | B10 | | 7
- ēǻ͓Γד | Z01 | | 8
+ 듾 | “׾ړ | 1a󓱸 | character_length
+------------------+----------+------------+------------------
+ ēǻ͓𓽺Ó | ѦA01߾ | | 8
+ ēǻ͓דȓ | B10 | | 7
+ ēǻ͓Γד | Z01 | | 8
(3 rows)
select *,octet_length(듾) from ͪߩѦ듾;
- 듾 | “׾ړ | 1a󓱸 | octet_length
---------------------------+--------------+----------------+--------------
- ēǻ͓𓽺Ó | ѦA01߾ | | 24
- ēǻ͓דȓ | B10 | | 21
- ēǻ͓Γד | Z01 | | 24
+ 듾 | “׾ړ | 1a󓱸 | octet_length
+------------------+----------+------------+--------------
+ ēǻ͓𓽺Ó | ѦA01߾ | | 24
+ ēǻ͓דȓ | B10 | | 21
+ ēǻ͓Γד | Z01 | | 24
(3 rows)
select *,position('' in 듾) from ͪߩѦ듾;
- 듾 | “׾ړ | 1a󓱸 | position
---------------------------+--------------+----------------+----------
- ēǻ͓𓽺Ó | ѦA01߾ | | 4
- ēǻ͓דȓ | B10 | | 0
- ēǻ͓Γד | Z01 | | 0
+ 듾 | “׾ړ | 1a󓱸 | position
+------------------+----------+------------+----------
+ ēǻ͓𓽺Ó | ѦA01߾ | | 4
+ ēǻ͓דȓ | B10 | | 0
+ ēǻ͓Γד | Z01 | | 0
(3 rows)
select *,substring(듾 from 3 for 4) from ͪߩѦ듾;
- 듾 | “׾ړ | 1a󓱸 | substring
---------------------------+--------------+----------------+--------------
- ēǻ͓𓽺Ó | ѦA01߾ | | ͓𓽺
- ēǻ͓דȓ | B10 | | ͓ד
- ēǻ͓Γד | Z01 | | ͓Γ
+ 듾 | “׾ړ | 1a󓱸 | substring
+------------------+----------+------------+-----------
+ ēǻ͓𓽺Ó | ѦA01߾ | | ͓𓽺
+ ēǻ͓דȓ | B10 | | ͓ד
+ ēǻ͓Γד | Z01 | | ͓Γ
(3 rows)
drop table test;
@@ -269,8 +269,8 @@ insert into test values('SLENSKA');
insert into test values('ENGLISH FRANAIS ESPAOL SLENSKA');
vacuum test;
select * from test;
- t
---------------------------------------
+ t
+-----------------------------------
ENGLISH
FRANAIS
ESPAOL
@@ -279,55 +279,55 @@ select * from test;
(5 rows)
select * from test where t = 'ESPAOL';
- t
-----------
+ t
+---------
ESPAOL
(1 row)
select * from test where t ~* 'espaol';
- t
---------------------------------------
+ t
+-----------------------------------
ESPAOL
ENGLISH FRANAIS ESPAOL SLENSKA
(2 rows)
select *,character_length(t) from test;
- t | character_length
---------------------------------------+------------------
- ENGLISH | 7
- FRANAIS | 8
- ESPAOL | 7
- SLENSKA | 8
+ t | character_length
+-----------------------------------+------------------
+ ENGLISH | 7
+ FRANAIS | 8
+ ESPAOL | 7
+ SLENSKA | 8
ENGLISH FRANAIS ESPAOL SLENSKA | 33
(5 rows)
select *,octet_length(t) from test;
- t | octet_length
---------------------------------------+--------------
- ENGLISH | 7
- FRANAIS | 9
- ESPAOL | 8
- SLENSKA | 9
+ t | octet_length
+-----------------------------------+--------------
+ ENGLISH | 7
+ FRANAIS | 9
+ ESPAOL | 8
+ SLENSKA | 9
ENGLISH FRANAIS ESPAOL SLENSKA | 36
(5 rows)
select *,position('L' in t) from test;
- t | position
---------------------------------------+----------
- ENGLISH | 4
- FRANAIS | 0
- ESPAOL | 7
- SLENSKA | 3
+ t | position
+-----------------------------------+----------
+ ENGLISH | 4
+ FRANAIS | 0
+ ESPAOL | 7
+ SLENSKA | 3
ENGLISH FRANAIS ESPAOL SLENSKA | 4
(5 rows)
select *,substring(t from 3 for 4) from test;
- t | substring
---------------------------------------+-----------
- ENGLISH | GLIS
- FRANAIS | ANA
- ESPAOL | PAO
- SLENSKA | LENS
+ t | substring
+-----------------------------------+-----------
+ ENGLISH | GLIS
+ FRANAIS | ANA
+ ESPAOL | PAO
+ SLENSKA | LENS
ENGLISH FRANAIS ESPAOL SLENSKA | GLIS
(5 rows)