|
1 | | -/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. |
| 1 | +/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 2 |
|
3 | 3 | This program is free software; you can redistribute it and/or modify |
4 | 4 | it under the terms of the GNU General Public License as published by |
@@ -6285,34 +6285,34 @@ int read_line(char *buf, int size) |
6285 | 6285 | /* Could be a multibyte character */ |
6286 | 6286 | /* This code is based on the code in "sql_load.cc" */ |
6287 | 6287 | #ifdef USE_MB |
6288 | | - int charlen = my_mbcharlen(charset_info, (unsigned char) c); |
| 6288 | + uint charlen = my_mbcharlen(charset_info, (unsigned char) c); |
| 6289 | + if (charlen == 0) |
| 6290 | + DBUG_RETURN(1); |
6289 | 6291 | /* We give up if multibyte character is started but not */ |
6290 | 6292 | /* completed before we pass buf_end */ |
6291 | 6293 | if ((charlen > 1) && (p + charlen) <= buf_end) |
6292 | 6294 | { |
6293 | | - int i; |
6294 | | - char* mb_start = p; |
6295 | | - |
6296 | | - *p++ = c; |
6297 | | - |
6298 | | - for (i= 1; i < charlen; i++) |
6299 | | - { |
6300 | | - c= my_getc(cur_file->file); |
6301 | | - if (feof(cur_file->file)) |
6302 | | - goto found_eof; |
6303 | | - *p++ = c; |
6304 | | - } |
6305 | | - if (! my_ismbchar(charset_info, mb_start, p)) |
6306 | | - { |
6307 | | - /* It was not a multiline char, push back the characters */ |
6308 | | - /* We leave first 'c', i.e. pretend it was a normal char */ |
6309 | | - while (p-1 > mb_start) |
6310 | | - my_ungetc(*--p); |
6311 | | - } |
| 6295 | + char* mb_start = p; |
| 6296 | + *p++ = c; |
| 6297 | + |
| 6298 | + for (uint i= 1; i < charlen; i++) |
| 6299 | + { |
| 6300 | + c= my_getc(cur_file->file); |
| 6301 | + if (feof(cur_file->file)) |
| 6302 | + goto found_eof; |
| 6303 | + *p++ = c; |
| 6304 | + } |
| 6305 | + if (! my_ismbchar(charset_info, mb_start, p)) |
| 6306 | + { |
| 6307 | + /* It was not a multiline char, push back the characters */ |
| 6308 | + /* We leave first 'c', i.e. pretend it was a normal char */ |
| 6309 | + while (p-1 > mb_start) |
| 6310 | + my_ungetc(*--p); |
| 6311 | + } |
6312 | 6312 | } |
6313 | 6313 | else |
6314 | 6314 | #endif |
6315 | | - *p++= c; |
| 6315 | + *p++= c; |
6316 | 6316 | } |
6317 | 6317 | } |
6318 | 6318 | die("The input buffer is too small for this query.x\n" \ |
|
0 commit comments