diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-05-04 22:00:24 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-05-04 22:00:24 +0200 |
commit | 49c853fb948aeaeb5c7e3f02da3f14da51ee4100 (patch) | |
tree | 8c3d487a02209cc0c6f126144f1340fc5897d527 /strings | |
parent | ae18a28500974351cf42fa3cac67c83e0647d510 (diff) | |
parent | 4c87f727734955f9e4a0ffde25aae4d43ec0b2a5 (diff) | |
download | mariadb-git-49c853fb948aeaeb5c7e3f02da3f14da51ee4100.tar.gz |
Merge branch '5.5' into 10.0
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-uca.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 60de0a106a1..2351ee9d932 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -1,5 +1,5 @@ /* Copyright (c) 2004, 2013, Oracle and/or its affiliates. - Copyright (c) 2009, 2014, SkySQL Ab. + Copyright (c) 2009, 2015, MariaDB This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -20583,7 +20583,25 @@ static int my_uca_scanner_next_any(my_uca_scanner *scanner) if (((mblen= scanner->cs->cset->mb_wc(scanner->cs, wc, scanner->sbeg, scanner->send)) <= 0)) - return -1; + { + if (scanner->sbeg >= scanner->send) + return -1; /* No more bytes, end of line reached */ + /* + There are some more bytes left. Non-positive mb_len means that + we got an incomplete or a bad byte sequence. Consume mbminlen bytes. + */ + if ((scanner->sbeg+= scanner->cs->mbminlen) > scanner->send) + { + /* For safety purposes don't go beyond the string range. */ + scanner->sbeg= scanner->send; + } + /* + Treat every complete or incomplete mbminlen unit as a weight which is + greater than weight for any possible normal character. + 0xFFFF is greater than any possible weight in the UCA weight table. + */ + return 0xFFFF; + } scanner->sbeg+= mblen; if (wc[0] > scanner->level->maxchar) |