summaryrefslogtreecommitdiff
path: root/strings/ctype-utf8.c
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-04-06 21:29:12 +0200
committerSergei Golubchik <sergii@pisem.net>2013-04-06 21:29:12 +0200
commit7b55b59b5792d87dedd946487769bc2b1dc36833 (patch)
tree4fc3e7f31a8d5a0f65c1ef4bef529bb2cf12be6d /strings/ctype-utf8.c
parent87a452f6d5839f9702d41d00137350fe9a38a774 (diff)
downloadmariadb-git-7b55b59b5792d87dedd946487769bc2b1dc36833.tar.gz
MDEV-4244 [PATCH] Buffer overruns and use-after-free errors
fixes for gcc 4.8 - compilation warnings and -fsanitize=address
Diffstat (limited to 'strings/ctype-utf8.c')
-rw-r--r--strings/ctype-utf8.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 425f5884392..9404afc5f11 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -4261,6 +4261,10 @@ static char filename_safe_char[128]=
#define MY_FILENAME_ESCAPE '@'
+/*
+ note, that we cannot trust 'e' here, it's may be fake,
+ see strconvert()
+*/
static int
my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e)
@@ -4282,7 +4286,7 @@ my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)),
return MY_CS_TOOSMALL3;
byte1= s[1];
- byte2= s[2];
+ byte2= byte1 ? s[2] : 0;
if (byte1 >= 0x30 && byte1 <= 0x7F &&
byte2 >= 0x30 && byte2 <= 0x7F)
@@ -4307,7 +4311,7 @@ my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)),
(byte2= hexlo(byte2)) >= 0)
{
int byte3= hexlo(s[3]);
- int byte4= hexlo(s[4]);
+ int byte4= hexlo(s[3] ? s[4] : 0);
if (byte3 >=0 && byte4 >=0)
{
*pwc= (byte1 << 12) + (byte2 << 8) + (byte3 << 4) + byte4;