diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2018-01-22 16:53:10 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2018-01-23 13:06:39 +0100 |
commit | a4663af05c1d1bd3abb537205df070ed2158e702 (patch) | |
tree | 935bf4702fc478f5ecb60c9194d37108161d5e13 /mysql-test | |
parent | ea78c5744b958ddcd6946faf5ca24f115275a366 (diff) | |
download | mariadb-git-a4663af05c1d1bd3abb537205df070ed2158e702.tar.gz |
MDEV-7533: COLUMN_JSON() doesn't escape control characters in string values
escape all charecters less or equal 0x1F (control symbols)
(shorter sequence are not used to make code simple, long encoding is always legal according to the rfc4627)
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/dyncol.result | 10 | ||||
-rw-r--r-- | mysql-test/t/dyncol.test | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index b0d28a81043..81446da9e14 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1873,5 +1873,15 @@ SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)); COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)) {"a":1,"b":1} # +# MDEV-7533: COLUMN_JSON() doesn't escape control characters +# in string values +# +SELECT COLUMN_JSON(COLUMN_CREATE('test','"\\\t\n\Z')) AS json; +json +{"test":"\"\\\u0009\u000A\u001A"} +SELECT COLUMN_JSON(COLUMN_CREATE('test','First line\nSecond line')) AS json; +json +{"test":"First line\u000ASecond line"} +# # end of 10.0 tests # diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index 03e2345ba1c..2c93f75cb5a 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -920,6 +920,14 @@ SELECT COLUMN_JSON(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL)); SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)); + +--echo # +--echo # MDEV-7533: COLUMN_JSON() doesn't escape control characters +--echo # in string values +--echo # +SELECT COLUMN_JSON(COLUMN_CREATE('test','"\\\t\n\Z')) AS json; +SELECT COLUMN_JSON(COLUMN_CREATE('test','First line\nSecond line')) AS json; + --echo # --echo # end of 10.0 tests --echo # |