From b6455479e588fe1309157e8cc77cca10b90942b6 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 7 Feb 2018 18:14:45 +0100 Subject: MDEV-15230: column_json breaks cyrillic in 10.1.31 Use unsigned comparison. --- mysql-test/r/dyncol.result | 10 ++++++++++ mysql-test/t/dyncol.test | 9 +++++++++ mysys/ma_dyncol.c | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index 81446da9e14..fe4ee3f7de2 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1883,5 +1883,15 @@ SELECT COLUMN_JSON(COLUMN_CREATE('test','First line\nSecond line')) AS json; json {"test":"First line\u000ASecond line"} # +# MDEV-15230: column_json breaks cyrillic in 10.1.31 +# +set names utf8; +create table t1 (b blob); +insert into t1 values (column_create('description',column_create('title','Описание'))); +select column_json(b) from t1; +column_json(b) +{"description":{"title":"Описание"}} +drop table t1; +# # end of 10.0 tests # diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index 2c93f75cb5a..7807d1a9f9e 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -928,6 +928,15 @@ SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)); 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 # MDEV-15230: column_json breaks cyrillic in 10.1.31 +--echo # +set names utf8; +create table t1 (b blob); +insert into t1 values (column_create('description',column_create('title','Описание'))); +select column_json(b) from t1; +drop table t1; + --echo # --echo # end of 10.0 tests --echo # diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 0c54bd7a581..909f9dcac41 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -3834,7 +3834,7 @@ my_bool dynstr_append_json_quoted(DYNAMIC_STRING *str, for (i= 0; i < len; i++) { register char c= append[i]; - if (unlikely(c <= 0x1F)) + if (unlikely(((uchar)c) <= 0x1F)) { if (lim < 5) { -- cgit v1.2.1