diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-04-06 21:29:12 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-04-06 21:29:12 +0200 |
commit | 7b55b59b5792d87dedd946487769bc2b1dc36833 (patch) | |
tree | 4fc3e7f31a8d5a0f65c1ef4bef529bb2cf12be6d /strings | |
parent | 87a452f6d5839f9702d41d00137350fe9a38a774 (diff) | |
download | mariadb-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')
-rw-r--r-- | strings/ctype-utf8.c | 8 |
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; |